Quantcast
Channel: Java Programming Forum - Learn Java Programming - Apache POI
Viewing all articles
Browse latest Browse all 120

java.lang.IllegalStateException: Cannot get a text value from a numeric cell

$
0
0
Hello,
I am trying to read from Excel file, ans as know when the cell is complete text then it is String type and if numeric then Double.
The Problem i tried to read a cell (Street column) which have mixed value type (string and numeric) for example :Johann-Wax-Str. 6

I used to read the cell if String
Code:

row.getCell(5).getStringCellValue()
and if Numeric
Code:

Double.toString(row.getCell(6).getNumericCellValue()
I supposed that the column Street (which is String & numeric) can be readed correctly with:
Code:

Double.toString(row.getCell(6).getNumericCellValue()
but that doesn't work, i get error
Code:

java.lang.IllegalStateException: Cannot get a text value from a numeric cell
I looked up for proper Instruction in Poi documentation but i do'nt find solution to read cell which have String and numeric
So what the wrong and how to fix it?

Viewing all articles
Browse latest Browse all 120