How to remove duplicates rows data from data table

i have 5 duplicates rows in one column , but i want to remove 4 records and keep only one record

Hello @T_Y_Raju

You can use Remove Duplicate Rows activity.

remve duplicates will remove the entire duplicates, but my requirment is i want to keep one record…

Did you try using it?

Hi @T_Y_Raju,

You only want to do it for one record, other renewals can stop, is it true?


yes i used …entire duplcates are getting removed

Check the below doc. You can do like that.

No, it won’t.

what is i and g stands for…plz explain this linq query completely


if entire duplicate rows are being removed I can only think it may be something to do with extra processing you are doing after the activity.

However there is another way to do it, create a copy of your datatable and then in a for each loop filter the datatable to find the number of duplicate rows. If it is a duplicate row then delete that row from the copy of your datatable.

Those are arguments for the ad hoc functions.


Those are the variable inside the linq query and you dont need to separately declare it.

It will group the table with the rows. So if there are duplicates it will get removed by keeping only one value.

Alos you can group activity in uipath.

my req is

Raju 123
Raju 456
Raju 123
Raju 123

here i want only 1 row rest 3 i want to delete

i did no get can u show me with example

this linq method …iam not able to understand clearly


Try like this.

Dt = dt.defaulview.ToTable(True,"Column Name)

Try this and let me know!


Hi, I had the same issue, try this

(From d In DT.AsEnumerable()
Group d By k1= d(“NAME”).toString.Trim
Into grp=Group
Select grp.First()).CopyToDatatable()


If you select all your rows then this is not going to happen just select single row and remove it, hope this will help you but it will also take time.

Thx so much sir, this Linq query is great!

Hi @T_Y_Raju
Try this:

yourDataTable = yourDataTable.AsEnumerable().GroupBy(Function(row) row.Field(Of String)("yourColumn")).Select(Function(group) group.First()).CopyToDataTable()

Hope it helps!!