I am attempting to use the ExcelWriter class to read the contents of an uploaded Excel file in a way where the code will process the data in any of the workbook's worksheets.
So something like this:
foreach (var worksheet in workbook.Worksheets)
{
var area = worksheet.PopulatedCells;
if (area == null)
break;
...do stuff with the cells in the area...
}
The problem is that when I call Worksheet.PopulatedCells I get an exception thrown saying that there aren't any populated cells when the worksheet is empty rather than returning me null.
Is there some way to detect if a Worksheet is empty?