This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes reading multiple sheets using apache POI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "reading multiple sheets using apache POI" Watch "reading multiple sheets using apache POI" New topic
Author

reading multiple sheets using apache POI

sai rama krishna
Ranch Hand

Joined: May 29, 2009
Posts: 275



I have above application which reads excel file and prints the content on the console. It is only printing sheet1. I have about 50 sheets. How to print all the 50 sheets on to console.
Any ideas, suggestions, sample code, links, source code highly appreciated. Thanks in advance
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42371
    
  64
There's a comment that says: "Get the first sheet from workbook". That's the spot I would start with.


Ping & DNS - my free Android networking tools app
Corrie L Sherone
Greenhorn

Joined: Jan 21, 2008
Posts: 19
Find the total number of sheets in the workbook. Then run the code for printing a sheet's values within a for loop. ie Repeat for each sheet.


Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

What line of that code gets the first sheet from the workbook? How might it be changed to get, I dunno, the second worksheet from the workbook? What methods are available on the API to get the number of worksheets from a workbook?

Listen, I know you have a lot of questions, but as I told you before, 99% of them are answerable if you look at the POI API. There really is good documentation there.


Steve
Corrie L Sherone
Greenhorn

Joined: Jan 21, 2008
Posts: 19
Steve Luke wrote:Listen, I know you have a lot of questions, but as I told you before, 99% of them are answerable if you look at the POI API. There really is good documentation there.


I second that. POI's API and documentation is very good. The busy developer's guide provides an excellent quick start to most common questions:
http://poi.apache.org/spreadsheet/quick-guide.html
sai rama krishna
Ranch Hand

Joined: May 29, 2009
Posts: 275
sure
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: reading multiple sheets using apache POI