using OfficeOpenXml; // Load the Excel file using the EPPlus package using (var package = new ExcelPackage(new FileInfo("MyExcelFile.xlsx"))) { // Get the worksheet var worksheet = package.Workbook.Worksheets[1]; // Delete the third column worksheet.DeleteColumn(3); // Save the changes to the file package.Save(); }
using OfficeOpenXml; // Load the Excel file using the EPPlus package using (var package = new ExcelPackage(new FileInfo("MyExcelFile.xlsx"))) { // Get the worksheet we want to modify var worksheet = package.Workbook.Worksheets["Sheet1"]; // Delete the third column worksheet.DeleteColumn(3); // Save the changes to the file package.Save(); }This code will delete the third column from the "Sheet1" worksheet and save the changes to the same file. Package library: EPPlus.