Hi @SAJID RAZA KHAN ,
Please check below code.
string[] files = Directory.GetFiles(@"C:\Test", "*.xlsx");
foreach (var item in files)
{
Excel.Application excel = new Excel.Application();
Excel.Workbook workbook = excel.Workbooks.Open(item);
Excel.Worksheet worksheet = workbook.Worksheets["Sheet1"];
worksheet.Columns[3].Delete();
workbook.Save();
Console.WriteLine("yes");
}
Don't forget to add Microsoft.Office.Interop.Excel in NuGet package.
Regards,
Zoe
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.