Adding or Inserting a Row into Worksheet

Adding a Row to Worksheet

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

  • Add Aspose.Cells.GridDesktop control to your Form
  • Access any desired Worksheet
  • Add Row 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 row to the worksheet
sheet.AddRow();

Inserting a Row into Worksheet

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

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

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

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

sheet.Cells.InsertRow(0);