I am opening an excel file like this:
Excel.Application xlApp;
Excel.Workbook xlWorkBook;
Excel.Worksheet xlWorkSheet;
Excel.Range range;
string str;
int rC
Once you have a reference to the worksheet say
for(int i = 1; i <=100; i++)
{
if(!worksheet.Cells[i,1].Contains("SomeString"))
{
((Range)worksheet.Rows[i]).Delete(shiftDirection)
}
}
where shiftDirection see here: Range.Delete method
You may have to cast the Cell's content to a string.
for (int i = dt.Rows.Count - 1; i >= 0; i--)
{
if (dt.Rows[i][1].ToString() == "SomeThing")
{
dt.Rows.RemoveAt(i);
}
}