com.tlv8.core.utils.ExcelUtils
支持xls和xlsx文件处理
Excel文件转换为Workbook
org.springframework.web.multipart.MultipartFile
Workbook workbook = ExcelUtils.getWorkbook(multipartfile);
java.io.File
Workbook workbook = ExcelUtils.getWorkbook(file);
获取工作簿Sheet
Sheet sheet = ExcelUtils.getSheet(workbook,sheetNum);
sheetNum为sheet编号,从0开始。
读取Excel内容到字符数组
Workbook workbook = ExcelUtils.getWorkbook(file); String[][] datas = ExcelUtils.readSheet(workbook, 0);
获取Excel指定单元格的值
Workbook workbook = ExcelUtils.getWorkbook(file); Sheet sheet = ExcelUtils.getSheet(workbook,sheetNum); String v = ExcelUtils.getCellValue(sheet,col,row);
Powered By layui