How to delete row from excel

using for loop I am getting data one by one.Now what I need to pass in remove data row activity inside row property that remove current data row


You have to pass row into Remove DataRow activity.

ForEach row in inputDT
Pass row to Remove DataRow

1 Like


And also note that create posts under RPA Developers section if you face any issues related to development but not under All Products and Services. As of now I changed it and please keep it in mind this when you are creating new post.


no actually.I am facing this issue


Check this xaml, it may help you
DeleteRowInExcel.xaml (12.1 KB)

not opened getting error like looking for package to install


From what I understand, You are reading an excel file into a datatable using “Read Range” activity.

Now you want to use “Remove data row” activity to remove the particular row and you are wondering what all properties are required for that to happen.

Considering above to be true, you can give out (datatable name) and (column name OR column index)

Thanks and Regards,

1 Like

@hacky Right.ok When I pass the column name it removed entire row…?
and I already pass one column then I am getting error as mentioned in attachment.

you mean to like this


Install UiPathTeam.Excel.Extensions.Activities packages then try with the xaml.

1 Like

client not agree to install the activity for just delete row.I am using remove data row activity what I need to pass in row I am passing index as mentioned in attachment but not work


1 Like

When you were using the Remove Data Row Activity and you passed in the Argument row.Item(1) you are targeting a specific cell.

          Col 1     |    Col 2    |    Col 3    | 
 Row 1| row.Item(1) | row.Item(2) | row.Item(3) |
 Row 2| row.Item(1) | row.Item(2) | row.Item(3) |
 Row 3| row.Item(1) | row.Item(2) | row.Item(3) |
 Row 4| row.Item(1) | row.Item(2) | row.Item(3) |
 Row 5| row.Item(1) | row.Item(2) | row.Item(3) |

The rows can be accessed by the following: DTVar.Rows(1)

So if I wanted to delete the 3rd Row in the DataTable built from the above sheet, I would need to pass the argument DTVar.Rows(3) and that would target the entire row of the DataTable. But if you’re looping through the rows of the DataTable in a For Each Row Activity as follows:

foreach (DataTable.Row row in DTVar){
    ... //Code

You will need to pass the row variable, but it may not let you edit the collection while iterating through it. You can use the Index Counter variable within the Activity to track where you are and delete the corresponding items if needed. But when you pass the row.Item(2) as the argument, it is referencing specifically the B Column of that row, it doesn’t specify the row number in the row variable.

Hope this helps, it ended up longer than I wanted it to be, sorry!

Also this will not delete the row in excel, but only in the datatable :wink:
if you have the row numbers that you want to delete you can use: UiPath.Excel.Activities.ExcelInsertDeleteRows

Hi @Aditya10989,

I was little busy with development.


can someone help me. I want to delete row in my excel that contains (GRADUATED, DISCONTINUED)