Add new worksheet

Hi Laurence,

Can I add a new worksheet as the first or second worksheet of the workbook?

The API only shows how to append a worksheet to the workbook, so it will always be the last sheet.

thank you

You can append the worksheet and then use Worksheet.Move method to change it to the first or second sheet.

@me2005,
Aspose.Cells has replaced Aspose.Excel that is no more available now and is discarded. You can use this new product to work with all the legacy and advanced features of different versions of MS Excel. Aspose.Cells allows to create new worksheet, copy worksheet within and between different workbooks. Similarly worksheets can be moved within a workbook. Following example demonstrates this feature:

// Open an existing Excel file.
Workbook wb = new Workbook();

// Create a Worksheets object with reference to
// the sheets of the Workbook.
WorksheetCollection sheets = wb.Worksheets;

sheets[0].Cells["A1"].Value = "Data on worksheet 1";
// Copy data to a new sheet from an existing
// sheet within the Workbook.
int index = sheets.AddCopy("Sheet1");
sheets[index].MoveTo(0);            
// Save the Excel file.
wb.Save("CreateCopyAndMoveWithinWorkbook_out.xls");

The following document describes the copying and moving worksheets feature in detail:
Copying and Moving Worksheets

Download the free latest trial version here:
Aspose.Cells for .NET (Latest Version)

Here is ready to run solution that can be used to test the product features without writing any code.