Skip to content

Instantly share code, notes, and snippets.

@openize-cells-gists
Last active May 22, 2024 13:07
Show Gist options
  • Save openize-cells-gists/ea4d0e6848f151ab3e1054e4443590fc to your computer and use it in GitHub Desktop.
Save openize-cells-gists/ea4d0e6848f151ab3e1054e4443590fc to your computer and use it in GitHub Desktop.
This C# example illustrates how to insert a specific number of columns into an Excel worksheet using the Openize.Cells Sdk. The process involves loading the workbook, selecting the target worksheet, inserting the desired number of columns from a specified start column, and saving the workbook to apply the changes.
using Openize.Cells;
using (Workbook wb = new Workbook(filePath))
{
string startColumn = "B";
int numberOfColumns = 3;
Worksheet firstSheet = wb.Worksheets[0];
int columnsCount = firstSheet.GetColumnCount();
firstSheet.InsertColumns(startColumn, numberOfColumns);
Console.WriteLine("Columns Count=" + columnsCount);
wb.Save(filePath);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment