1、首先是pom.xml,添加依赖。
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.17</version>
</dependency>
2、Controller层代码
@ResponseBody
@RequestMapping("/importExcel")
public WebResult importExcel(@RequestParam("file") MultipartFile file) throws IOException {
int success = 0;
try {
ExcelData data = ExcelRead.getInst().parse(file.getInputStream(), file.getOriginalFilename(), false, true);
List<String[]> datas = data.getDatas(