Cannot get a text value from a numeric cell “Poi”

前端 未结 11 2050
余生分开走
余生分开走 2020-12-07 22:17

I\'m trying to consume data from a spreadsheet in Excel, but always of this error, already tried formatting the worksheet to text and number and still the error persists.

11条回答
  •  爱一瞬间的悲伤
    2020-12-07 23:09

    CellType cell = row.getCell(j).getCellTypeEnum();
    
    switch(cell) {
        case NUMERIC:
            intVal = row.getCell(j).getNumericCellValue();
            System.out.print(intVal);
            break;
        case STRING:
            stringVal = row.getCell(j).getStringCellValue();
            System.out.print(stringVal);
            break;
    }
    

提交回复
热议问题