Free Support Forum -

How to get last row with data


I am using Aspose Our excel template has many rows which user fills up as part of process and upload it. We dont know how many rows user have filled up. We know start row to iterate but don’t know till how many rows we have to go to find data. How do i get that in Aspose Cell. Java

In some of the forum i read to use Worksheet.Cells.MaxDataRow. However my eclipse is not able to find it

Workbook wb = new Workbook();


Worksheet ws = wb.Worksheets[0];

int maxDataRow = ws.Cells.MaxDataRow //when i type ws.Cells, it doesn’t come.

Is this deprecated or there is other way to get it?




Thanks for your posting and using Aspose.Cells for Java.

Please type ws.getCells().getMaxDataRow(). It should show in Eclipse. You were using .NET code. I have translated it into Java code for your needs.


Workbook wb = new Workbook(filePath);

Worksheet ws = wb.getWorksheets().get(0);

int maxDataRow = ws.getCells().getMaxDataRow();

Thank you very much for the help!


Good to know that your issue is resolved. If you face any other issue, please feel free to post on our forums, we will be glad to assist you further.

Thank you.