How can I delete all rows in an Excel with a certain value?

Hi, I want to delete all rows in an Excel table where the column “Status” has the value “complete”.
What I did:

  1. Read the Excel
  2. Copy datatable
  3. For each row in copied datatable delete in original datatable
    → Here I get the error “The given DataRow is not in the current DataRowCollection”
  4. Write down original datatable

Hi,
what about using FilterDataTable activity?

https://activities.uipath.com/docs/filter-data-table

Cheers

1 Like

@Jizh

You can use Filter dataTable activity and pass dataTable as input coming from Read Range activity and put condition like

“ColumnName” equals “Complete”

And also click radio button remove and this activity will give you output as dataTable.
Then use Write Range activity to write into Excel file.

https://activities.uipath.com/docs/filter-data-table

2 Likes

Remove_Row.zip (20.9 KB)

Hope This would help

Regards,
Ashley Nihal Dcunha

1 Like

@lakshman How can I replace the complete Excel? Now it only overwrites the first rows as the new list is shorter. Is there still no option to replace a table? I now use the workaround to copy the blank lines as well.

1 Like

@ashley11 thanks for the example :slight_smile:

@Jizh

Use Write Cell activity before write range activity and specify below.

Range: “A1:D100” (use range according to your data)
Value: " "

The above activity will write empty values all over Excel file. Then it write filtered data using Write Range activity.

1 Like

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