|Summary:||poi cannot read date is when first column is empty and second column in date|
|Component:||HSSF||Assignee:||POI Developers List <dev>|
|Bug Depends on:||57002, 56702|
Description sushen20 2014-10-06 21:29:00 UTC
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.
Comment 1 Nick Burch 2014-10-06 22:15:29 UTC
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
Comment 2 sushen20 2014-10-08 21:22:14 UTC
Created attachment 32094 [details] Test file I hope this file would give you better picture what I am trying to upload.
Comment 3 sushen20 2014-10-08 21:23:37 UTC
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.
Comment 4 Nick Burch 2014-10-09 00:21:28 UTC
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...
Comment 5 Herve 2015-09-03 10:29:50 UTC
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.