Last active
May 22, 2024 13:07
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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