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 How to read excel2007 file or both .xls and .xlsx files 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 "How to read excel2007 file or both .xls and .xlsx files using apache poi" Watch "How to read excel2007 file or both .xls and .xlsx files using apache poi" New topic
Author

How to read excel2007 file or both .xls and .xlsx files using apache poi

harini veerapur
Greenhorn

Joined: Jun 29, 2010
Posts: 9
Dear sir,
How to read a .xlsx files using poi ,i am able to read only .xls files using poi and if i read a .xlsx file it throws an exception so give me some sample code to read both .xls and .xlsx files using poi .
Thanks........
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41591
    
  55
Note that POI versions before 3.5 do not support XSLX.

If you are, in fact, using a POI version that does support XLSX, post the code you're using. Knowing what exception is thrown would also be useful.


Ping & DNS - my free Android networking tools app
harini veerapur
Greenhorn

Joined: Jun 29, 2010
Posts: 9
My code as follows...




Thanks...
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41591
    
  55
The HSSF* classes are for working with XLS files, not XLSX. There are other classes (in some package called *.ss.*) that work with both formats; the POI documentation has the details on that.
 
 
subject: How to read excel2007 file or both .xls and .xlsx files using apache poi