New Column:
In this article we will cover, how we can insert a new column in Excel sheet using VSTO (Visual Studio Tools for Office) C# code.
Prerequisites:
- Visual Studio 2015 or above having Microsoft Office for Developer Tool installed
- Create Excel Addin in C# code style
- Create a ribbon designer and put button
Code Example:
private void btnInsertSheetColumn_Click(object sender, RibbonControlEventArgs e) { //capture user selection excel.Range oRange = Globals.ThisAddIn.Application.Selection; //Adding new Column oRange.EntireColumn.Insert(); }
Run the given code and see two steps, before inserting how the data looks like in a sheet and post code execution who data looks like:
Before code execution:

After code execution:

Please leave your valuable comments!!!
Next: Add new worksheet in Excel workbook using C# VSTO