• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

sheet.getLastRowNum() returns -1

 
aadesh dongre
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic