How can I enumerate all the excel sheets name using NPOI? As a quick workaround, I'm using the following. But I feel super guilty for doing it...
try
{
IWorkbook Iwb;
Iwb = new XSSFWorkbook(filepath);
int i = 0;
while (i < 100)
{
MessageBox.Show(Iwb.GetSheetAt(i).SheetName);
i++;
}
}
catch (Exception ex)
{//Do Nothing..
}
There's a NumberOfSheets
property that you can use.