Bug 56278 - Workbook Opens in Excel But Not POI Due To NPE
Summary: Workbook Opens in Excel But Not POI Due To NPE
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.10-FINAL
Hardware: PC Mac OS X 10.4
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2014-03-17 18:09 UTC by Greg Leib
Modified: 2014-05-14 20:19 UTC (History)
1 user (show)

File opens in Excel but not in POI (7.59 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2014-03-17 18:09 UTC, Greg Leib

Note You need to log in before you can comment on or make changes to this bug.
Description Greg Leib 2014-03-17 18:09:45 UTC
Created attachment 31395 [details]
File opens in Excel but not in POI

I am trying to open a workbook that I believe is in XLSX format from an older version of Excel. I'm not entirely sure of the file format, because the file was downloaded from http://members.fhlbdm.com/member-tools/advance-rates/csv/ which is a banking website not under my control. I am able to open the file directly in Excel, but not in POI. Here's the stack trace I'm getting when I try to create a new XSSF workbook using an input stream of the file:

	at org.apache.poi.xssf.usermodel.XSSFWorkbook.onDocumentRead(XSSFWorkbook.java:284)
	at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:159)
	at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:221)

Please find the file attached. I'm running JDK 7 update 51 and this trace was taken from a JUnit test case executed in IntelliJ IDEA. I'm using POI with the OOXML module, built using Maven.

I've tried searching the internet for this exception, and I see a few descriptions of similar behavior but no resolutions. The following external link may also be related http://stackoverflow.com/questions/18274995/nullpointerexception-when-trying-to-read-xlsx-file as it is also a Mac and a similar error. In this tracker, my problem may be related to ticket 16488, since the spreadsheet does have some cells with Excel warnings. 

Thanks in advance!
Comment 1 Nick Burch 2014-03-17 19:02:43 UTC
Your file is missing a styles table, which we assumed files would always have

Fixed in r1578518 - we now create one if missing, just as we do for a missing SST
Comment 2 Greg Leib 2014-03-17 20:43:06 UTC
Thank you Nick!
Comment 3 Dominik Stadler 2014-05-14 20:19:32 UTC
*** Bug 56490 has been marked as a duplicate of this bug. ***