Have a look at the two getSheetAt() methods defined in the HSSFWorkbook class. 
One will allow you to recover a sheet by passing it's name to the method, the 
other by passing it's index - and remember that as with arrays in Java, that 
index number is zero based. So, to get a particular sheet, all you need to do 
is;

* Open the workbook
* Call the getSheetAt() method and store the returned HSSFSheet reference into 
a variable.
* Process the sheet

It may also be worth looking at the getNumberOfSheets() method. This will 
return an int value that indicates how many sheets there are in the workbook 
and I can imagine a situation where you want the final sheet for instance 
without knowing how many the user may have inserted in front of it.

--- On Fri, 8/29/08, RonnieSpike <[EMAIL PROTECTED]> wrote:
From: RonnieSpike <[EMAIL PROTECTED]>
Subject: HOWTO Read only the first, or one, worksheet
To: [email protected]
Date: Friday, August 29, 2008, 10:41 AM

Hi,

We process excel workbooks that begin as templates for our users, templates
whose drop-down lists are maintained on the 2nd worksheet or tab of the
workbook. In processing the workbook, the 2nd worksheet is also being
processed - not what we want. Does anyone have an example or guidance on how
to process the first (or any particular) worksheet or tab of the workbook?
Thanks!

Ronnie
-- 
View this message in context:
http://www.nabble.com/HOWTO-Read-only-the-first%2C-or-one%2C-worksheet-tp19224451p19224451.html
Sent from the POI - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




      

Reply via email to