File file = new File("D:\\Users\\Administrator\\Desktop\\demo.xlsx");
try {
FileInputStream stream = new FileInputStream(file);
XSSFWorkbook workbook = new XSSFWorkbook(stream);
//读取sheet页
XSSFSheet sheet = workbook.getSheetAt(0);
// 第一行是表头,数据在第二行(下标是1)
for (int i = 1;i<=sheet.getLastRowNum();i++){
XSSFRow row = sheet.getRow(i);
String basicTypeCode = row.getCell(1)==null?null:row.getCell(1).getStringCellValue();
String code = row.getCell(2)==null?null:row.getCell(2).getStringCellValue();
int basicType = (int) row.getCell(3).getNumericCellValue();
String kkName = row.getCell(10)==null?null:row.getCell(10).getStringCellValue();
String ruName = row.getCell(11)==null?null:row.getCell(11).getStringCellValue();
}
stream.close();
}catch (Exception e){
e.printStackTrace();
}