Deleting filtered data in column

I am a beginner, After applying the filter on excel, I want to delete the filtered columns data but I either end up deleting the whole colmn or rows after filtering. Any help would be greatly appriciated. I want to delete the data in the column after filtering the column. i.e.

So under the district column I want to delete the highlighted values in that column after filtering.
i.e. I have applied a filter to show numbers with 169, after applying the filter, I want to delete the number that start with 169

You don’t usually work with Excel using UI automation (ie clicking around in Excel). What you should do is use the Excel activities to read it into a datatable, then Filter Data Table to remove the rows you want, then Write Range back to a new Excel file and delete the old file.

Hi @lalitrocks.akshana

  1. Take Read Range Activity= Output DT as DataTable
  2. Take Assign Activity and use below expression.

DT.AsEnumerable().Where(Function(row) If(row(“District”).GetType() Is GetType(String), Not row.Field(Of String)(“District”).StartsWith(“169”), True) AndAlso If(row(“District”).GetType() Is GetType(Double), Not row.Field(Of Double)(“District”).ToString().StartsWith(“169”), True)).CopyToDataTable()

For Reference you can check below images.

INPUT
image

OUTPUT
image

Hope it will helps you :slight_smile:
Cheers!!

Hello @lalitrocks.akshana

Sequence
Read Range (Excel Read)
For Each Row
If (Condition: row(“District”).ToString.StartsWith(“169”))
Assign (row(“District”) = “”)
Write Range (Excel Write)

Thanks & Cheers!!!