File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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.
 
 
subject: sheet.getLastRowNum() returns -1
 
Similar Threads
Problem with setBinaryStream
Finally {IOException}
Can a static final constant throw an exception?
Delete a row from an Excel sheet with Apache POI / HSSF?
In struts I am getting an error