Adding or Inserting a Column into Worksheet

Adding a Column to Worksheet

To add a new column to the worksheet, please follow the steps below:

  • Add Aspose.Cells.GridDesktop control to your Form
  • Access any desired Worksheet
  • Add Column to the Worksheet
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Accessing first worksheet of the Grid
Worksheet sheet = gridDesktop1.Worksheets[0];
// Adding column to the worksheet
sheet.AddColumn();

Inserting a Column into Worksheet

To insert a new column into worksheet at a specified position, please follow the steps below:

  • Add Aspose.Cells.GridDesktop control to your Form
  • Access any desired Worksheet
  • Insert Column into Worksheet (at a specific position by specifying the index of the column where to insert it)
 // Accessing first worksheet of the Grid

Aspose.Cells.GridDesktop.Worksheet sheet = gridDesktop1.Worksheets[0];

// Inserting column to the worksheet to the first position.

sheet.Cells.InsertColumn(0);