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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With