This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Other Open Source Projects and the fly likes error reading excel file using apache poi Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "error reading excel file using apache poi" Watch "error reading excel file using apache poi" New topic
Author

error reading excel file using apache poi

Priya Bhagat
Greenhorn

Joined: Jul 27, 2009
Posts: 2
I am trying to read data from excel file but it is giving me the following error:

Exception in thread "main" org.apache.poi.poifs.filesystem.OfficeXmlFileException: The supplied data appears to be in the Office 2007+ XML. POI only supports OLE2 Office documents
at org.apache.poi.poifs.storage.HeaderBlockReader.<init>(HeaderBlockReader.java:108)
at org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:151)
at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:312)
at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:293)
at Test.displayFromExcel(Test.java:46)
at Test.main(Test.java:28)

I am using Apache HSSF-POI version 3.2-FINAL-20081019.
My file has .xls extension.
Any idea what's wrong?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41571
    
  54
POI apparently suspects that it is not an XLS file, but an XLSX file - is it? If so, you need to use the POI 3.5 beta version (which supports Office Open XML - something POI 3.2 does not do).


Ping & DNS - my free Android networking tools app
Priya Bhagat
Greenhorn

Joined: Jul 27, 2009
Posts: 2
Hi Dittmer,

Thank you for your reply. Actually i wasn't using a correct file type. I was appending .xls extension to an Open Office org file preveously so only it was giving that error.
I tried with a MS-Excel (2003) file then it's working fine.
 
jQuery in Action, 2nd edition
 
subject: error reading excel file using apache poi