Reputation: 17355
I am creating a excel using apache POI.
There would always be headers as the first row.
Based on the logic, there could be data rows or not.
As the end step, I am mailing the generated report.
However, I do not want to send empty file in the mail.
Is there a method which checks for the rows and returns the number of rows in the generated excel. So that I can have that condition used to decide whether to mail the report or not.
Upvotes: 1
Views: 73
Reputation: 18459
Worksheet.getLastRowNum()
will return the last row count. You may able to use to see if you any 'real data'.
(IMHO, not generating the file may be more useful approach)
Upvotes: 1