Remove duplicates from excel file


How to remove duplicates in region column…i.e.,AAA
Thanks…

Hi,

You can use filter datatable activity and in the condition you can remove the duplicates row.

I will try it,thank youu

I hope there is no duplicate ROWS in your excel image
But still to remove the duplicate records in a excel use read range activity and get the output with a variable of type datatable named dt and We can use REMOVE DUPLICATE ROWS activity

Cheers @narayan_swamy5a6

1 Like

I usually use a list variable and check if row value is in this variable, then skip the row, if not - I add value to this variable and read row

@narayan_swamy5a6

Try these steps:

  1. Use Read Range activity to read data from excel file and will give you output as DataTable and say ‘DT’
  2. Then try this expression toremove duplicates:
             newDT = DT.DefaultView.ToTable(True,"Region").CopyToDataTable
  1. And then use Write Range activity to write into exel file and pass that newDT as input to it.
2 Likes

HI @lakshman
This works… but its writing only one column.
example say, “Region” in the above image. not the other columns!!

1 Like

This is returning only one column, not displaying other column. Can some one help to get that info.

Mention all the column name it will work
dt.DefaultView.ToTable(True,{“Region”, “Rep”})

Can i delete row when both columns have same data irrespective of other columns?