i have tried this for deleting A,B,C coloums but getting error
excelRange.get_Range("A,B,C", Missing.Value);
excelRange.EntireColumn.Delete(Missing.Value);
System.Runtime.InteropServices.Marshal.ReleaseComObject(excelRange);

Ganesan CRank #369 · 6.8K reputationPosted Aug 25, 2021, 3:05 PM EDT
Try this.
Ranjith Balan34 reputationPosted Aug 25, 2021, 3:20 PM EDT
Leon DRank #851 · 2.6K reputationPosted Aug 25, 2021, 9:16 PM EDT
You can install Free Spire.XLS library via nuget, and then use the following code to delete columns with ease.
Workbook workbook = new Workbook(); workbook.LoadFromFile(@"..\excel.xlsx"); //get the first worksheet Worksheet sheet = workbook.Worksheets[0]; for(int i = 10; i >= 1; i--) { //delete the first 10 columns in the first sheet sheet.DeleteColumn(i); } //save the excel file workbook.SaveToFile("sample.xlsx", ExcelVersion.Version2010);