This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Java in General and the fly likes sheet.getLastRowNum() returns -1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "sheet.getLastRowNum() returns -1" Watch "sheet.getLastRowNum() returns -1" New topic
Author

sheet.getLastRowNum() returns -1

aadesh dongre
Greenhorn

Joined: Dec 01, 2010
Posts: 2
String filename = "D:\\PersonalValuesAssets.xlsx";


FileInputStream fis = null;
fis = new FileInputStream(filename);
XSSFWorkbook workbook = new XSSFWorkbook(fis);
XSSFSheet sheet = workbook.getSheetAt(0);
Iterator rows=null;
rows = sheet.rowIterator();

int number=sheet.getLastRowNum();

System.out.println(" number of rows: "+ number);

Here, number returns -1 as the .xlsx file currently have more than 1.5 lakhs records.
To execute this program I had also increases the heap size using the VM parameters to min 512 MB ans max to 1280 MB.

Please help me to out from this thing...

Thanks in advance.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: sheet.getLastRowNum() returns -1
 
jQuery in Action, 3rd edition