How to delete rows from Excel file by C# code?
Posted on 2006-06-06
I need to delete rows from an existing excel file.
I can open the file and read and write, but I also need to delete rows from it.
I saw fome VB.NET examples but could not modify them to C#.
I use this code to open a file and a worksheet:
oXLMisc = new Excel.Application();
oWBMisc = oXLMisc.Workbooks.Open(miscFileName, 0, false, 5, "", "", true,
Excel.XlPlatform.xlWindows, "\t", false, false, 0, 0, 0, 0);
sheetsMisc = oWBMisc.Worksheets;
oSheetMisc = (Excel.Worksheet)sheetsMisc.get_Item(1);
But a statement like one if the two below fails.
I'll appreciate your help.