Lookup Value in DT and delete all the rows

Above data available in Datatable format

How to lookup for “Cancellations” word and How to delete all the rows below the lookup value in DT including the row the lookup value is available?

you can use filter datatable and remove those lines


Use find/Replace activity and search for Cancellations… This would give the cell value as output

now use delete rows activity with specific rows option and give the rows like this System.Text.RegularExpressions.Regex.Match(cellvalue,"\d+").Value + "-" + (Excel.sheet("Sheetname").RowCount+1).ToString

If in datatable please try this

dt.AsEnumerable.Take(dt.Rows.IndexOf(dt.AsEnumerable.Where(function(x) x(0).ToString.Contains("Cancellations"))(0))-1).CopyToDataTable


1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.