Copy a Worksheet

Copying a Worksheet

Using Sheet index

The example code below shows how to add a copy of a worksheet to the GridWeb control by specifying the worksheet’s index in the GridWorksheetCollection’s AddCopy method.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Adding the copy of a worksheet to GridWeb by specifying its sheet index
int sheetIndex = GridWeb1.WorkSheets.AddCopy(0);

Using Sheet Name

The example code below shows how to add a copy of a worksheet to the GridWeb control by specifying the worksheet’s name in the GridWorksheetCollection’s AddCopy method.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Adding the copy of a worksheet to GridWeb by specifying its sheet name
int sheetIndex1 = GridWeb1.WorkSheets.AddCopy("Students");