views:

142

answers:

1

I'm using hssf api for reading data from xls files. But is there any way to get the exact no. of sheets in a workbook containing stored data?

+2  A: 

What does getNumberOfSheets return you?

Narayan
Thank U! It gave me the no. of sheets in the workbook but is there any way to know whether the sheet contains any data or not,means if there is data only in first sheet and not in other two then? Similarly is there any way to know the region occupied by the data in terms of rows and columns?
Supereme
@Supriya, You need to iterate through each Sheet in the workbook, then check whether the sheets contains rows, and then the rows containing cells contain any data, through the Enums provided by the HSSF class Check the Example given herehttp://www.javaworld.com/javaworld/javaqa/2002-05/01-qa-0503-excel3.html
Narayan
@Narayan, Thank you I got that and also could implement it successfully! :)
Supereme
NP at all, glad it helped =]
Narayan