Free Support Forum - aspose.com

Determining number of sheets in a workbook

Hi,

Does anyone know how to determine how many sheets are in an xls document?

In the excel gui, you can see the number of sheets in the content tab under properties. I’ve tried looking through the buildinproperties function of aspose cells but cannot find it. I am new to Aspose.Cells and am using c#.

Is there a built in function for this?

Thanks!


Hi,

Thanks for considering Aspose.

Well, you may use Worksheets.Count property to get the number of of sheets a workbook holds.

E.g.,

Workbook workbook =new Workbook();
workbook.Open("d:\\test\\mybook.xls");
Worksheets worksheets = workbook.Worksheets;
int totalsheets = worksheets.Count ;
.
.
.
Since you are new to Aspose.Cells, we appreciate if you could check our Wiki documentation to know more about the component features and their implementation using its APIs: http://www.aspose.com/Wiki/Default.aspx/Aspose.Cells/
Thank you.