//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); // Add a new worksheet to the workbook. The worksheet will be inserted into the end of the existing worksheet collection. workbook.Worksheets.Add(); //Add a new worksheet to the specified position in the collection of worksheets. workbook.Worksheets.AddBefore(workbook.Worksheets[0]); workbook.Worksheets.AddAfter(workbook.Worksheets[1]); //Set worksheet's name. workbook.Worksheets[2].Name = "Product Plan";
' Create a new Workbook Dim workbook As New Workbook ' Add a new worksheet to the workbook. The worksheet will be inserted into the end of the existing worksheet collection. workbook.Worksheets.Add() 'Add a new worksheet to the specified position in the collection of worksheets. workbook.Worksheets.AddBefore(workbook.Worksheets(0)) workbook.Worksheets.AddAfter(workbook.Worksheets(1)) 'Set worksheet's name. workbook.Worksheets(2).Name = "Product Plan" ' save to an excel file workbook.Save("AddWorksheet.xlsx")