Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

reading multiple sheets using apache POI

 
sai rama krishna
Ranch Hand
Posts: 432
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's a comment that says: "Get the first sheet from workbook". That's the spot I would start with.
 
Corrie L Sherone
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4181
22
IntelliJ IDE Java Python
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Corrie L Sherone
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 432
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sure
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic