We are trying to read a excel file; first column of the row contains some data and following column contains date and there are some additional columns following the date. When the first column is empty, poi is not able to read the date from the second column however the same date is read by POI when the first column in the row has some data. P.N. Rest of the columns following the date is read by POI correctly. Please suggest.
Can you produce a small junit unit test that demonstrates the problem? As it is described, what you say you're doing should work fine, and is checked by quite a few unit tests, so we'll need some more details to work out what's wrong
Created attachment 32094 [details] Test file I hope this file would give you better picture what I am trying to upload.
Here is the stack trace for the error: java.lang.IllegalStateException: Cannot get a numeric value from a text cell at org.apache.poi.xssf.usermodel.XSSFCell.typeMismatch(XSSFCell.java:855) at org.apache.poi.xssf.usermodel.XSSFCell.getNumericCellValue(XSSFCell.java:213) at org.apache.poi.ss.usermodel.DateUtil.isCellDateFormatted(DateUtil.java:444) When the first column has data/text, it is able to read the second column as date however when the first column is empty, it tries to read the second column as string and errors out.
What's the code you're using to read the cells? From the exception given, I fear the problem may be there not in POI...
I got this bug in 3.12final too. I think it has a common cause with https://bz.apache.org/bugzilla/show_bug.cgi?id=56702 so I put my comment only in the 56702 and I put a dependency upon this bug.