Remove a Worksheet

Removing a Worksheet

To remove a worksheet using Aspose.Cells.GridDesktop control, please follow the steps below:

  1. Add the Aspose.Cells.GridDesktop control to a form.
  2. Call the Worksheets collection’s Remove method in the GridDesktop control.

Using Worksheet Index

In this approach, simply pass the worksheet index (in the worksheets collection of the grid) of the worksheet to be removed.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Removing a worksheet using its index
gridDesktop1.Worksheets.Remove(0);

Using Worksheet Name

If the name of the worksheet is known, it is possible to remove a specific worksheet by specifying its name.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Removing a worksheet using its index
gridDesktop1.Worksheets.RemoveAt("Sheet3");