This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft 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 Java 8 in Action this week in the Java 8 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: 160



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: 39575
    
  27
There's a comment that says: "Get the first sheet from workbook". That's the spot I would start with.


Ping & DNS - updated with new look and Ping home screen widget
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: 3968
    
  17

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: 160
sure
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: reading multiple sheets using apache POI
 
Similar Threads
resultsetmetadata
Java Code to export data to Excel
excel sheet data insertion
How to import data from Excel sheet to database using java??
Apache POI column Iternator