Articles in this section
Category / Section

How do I create a workbook with the specified number of worksheets?

1 min read

The workbook create method has overloads for specifying the number of worksheets:

C#

//Creates a workbook with Five worksheets.
IWorkbook myWorkbook = excelEngine.Excel.Workbooks.Create(5);

VB

'Creates a workbook with Five worksheets.
Dim myWorkbook As IWorkbook = ExcelEngine.Excel.Workbooks.Create(5)

There is also another overload for specifying the names of the worksheets when they are created:

C#

//Creates a workbook with five worksheets. The worksheets have the names specified in the string array.
IWorkbook myWorkbook = excelEngine.Excel.Workbooks.Create(new string[]{"One","Two","Three","Four","Five"});

VB

'Creates a workbook with five worksheets. The worksheets have the names specified in the string array.
Dim myWorkbook As IWorkbook = ExcelEngine.Excel.Workbooks.Create(New String() {"One", "Two", "Three", "Four", "Five"})

 

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied