Scenes
After the Excel file is imported, cells of pure numeric type cannot pass
getStringCellValue()
The method directly converts to String
and the original conversion method
cell.setCellType (CellType.STRING);
does not work and has been deprecated
New convert to String workaround
// index 为当前行的单元格索引值 即第几个单元格 row 为当前行 通过sheet 获取到
Cell nameCell = row.getCell(index);
String cellValue = new DataFormatter().formatCellValue(nameCell);
formatCellValue() After using this method, the value in excel can be read normally and it is String