Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot get a STRING value from a NUMERIC cell #4

Open
18916204759 opened this issue Jan 8, 2018 · 2 comments
Open

Cannot get a STRING value from a NUMERIC cell #4

18916204759 opened this issue Jan 8, 2018 · 2 comments

Comments

@18916204759
Copy link

java.lang.IllegalStateException: Cannot get a STRING value from a NUMERIC cell
at org.apache.poi.xssf.usermodel.XSSFCell.typeMismatch(XSSFCell.java:1077)
at org.apache.poi.xssf.usermodel.XSSFCell.getRichStringCellValue(XSSFCell.java:395)
at org.apache.poi.xssf.usermodel.XSSFCell.getStringCellValue(XSSFCell.java:347)
at com.xuxueli.poi.excel.ExcelImportUtil.importExcel(ExcelImportUtil.java:70)
at com.xuxueli.poi.excel.ExcelImportUtil.importExcel(ExcelImportUtil.java:135)

@rajbhandarisubodh
Copy link

The cell has interger value so you need to getNemericCellValue();
For example: sheet.getRow().getCell().getNumericCellValue();

@zoransi
Copy link

zoransi commented Aug 3, 2018

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;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants