java - getLastRowNum not returning correct number of rows -


i having small conundrum in using getlastrownum(). trying number of rows data excel sheet. supposing have 3 rows, should return in print out statement stating 3 rows. issue no matter how many rows populate, returning me fixed number. following excerpt of code:

fileinputstream fis = new fileinputstream("c:\\test data\\login.xlsx");  xssfworkbook wb = new xssfworkbook(fis); xssfsheet sheet = wb.getsheet("login"); system.out.println("no. of rows : " + sheet.getlastrownum()); 

my excel sheet consist of following

enter image description here

from attached image, should getting row count of 4, getting 6 instead.

any advice appreciated. thank in advance.

speaking attached file, should return row number of 3 because of xssfsheet.getlastrownum() zero-based. if receive number of 6, seems have 3 additional blank rows in sheet.

if open existing file , contains blank rows, here example how clean it. if fill table yourself, seems need check code places empty line created.


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -