Moving Worksheets

Move Worksheets within a Workbook

Aspose.Cells.GridDesktop provides a method, Aspose.Cells.GridDesktop.WorksheetCollection.MoveTo(), that is used to move a worksheet to the specified index. It takes the indexes (zero-based) of the source worksheet and destination worksheet as parameters. It is basically used to move a worksheet to another location in the same spreadsheet.

The following example shows how to move a worksheet to another location within the workbook.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Move the 2nd worksheet to 4th position.
gridDesktop1.Worksheets.MoveTo(1, 3);