How to delete excel rows based on filter?

i have an excel sheet and i need to filter column D with “2” then delete all the filtered rows

Hi @Ahmed_Raafat

To filter column D with the value “2” and delete the filtered rows in UiPath, you can follow these steps:

  1. Use the “Excel Application Scope” activity to open the Excel file.
  2. Within the scope, use the “Read Range” activity to read the data from the Excel sheet into a DataTable variable, let’s say dtData.
  3. Use the “Filter Data Table” activity to filter the DataTable based on the condition in column D. Set the filter condition to "[ColumnD] = '2'" (assuming the column name is “ColumnD”).
  4. The filtered DataTable will be stored in a new DataTable variable, let’s say dtFiltered.
  5. Use the “For Each Row” activity to iterate through each row in dtFiltered.
  6. Inside the loop, use the “Delete Row” activity to delete the current row from dtData.
  7. After the loop completes, use the “Write Range” activity to write the updated dtData back to the Excel file, overwriting the previous data.



Welcome to the community

Use filter excel activity and then use delete rows activity