Remove duplicates in excel

Hi
I want to remove duplicate rows by comparing the rows of the same column. If the content of row1 is ma to row 2 then delete row1 and so on till the end of selected rows.
example
column1
abc
abc
def
abc

output
abc
def
abc

plz proveide the solution with xaml file.

Thanks

Hi @Atul_Rai,

You could do it by using by the Remove Duplicate Rows activity Or using the following code:
DataTable distinctTable = dtRows.DefaultView.ToTable(true, "column1");

2 Likes

thanks @acaciomelo. can u provide the xaml

1 Like

Hi @Atul_Rai,

Atul_Rai is right. But in the UiPath also is having the activity to remove the duplicates by “Remove duplicate rows” activity. Below you can take an overview with the example.

Regards
Balamurugan

HI @balupad14,

Thanks for the reply.I am using studio. I don’t have “remove duplicate rows” activity. I tried to do it using loop but it is not working. I tried with following link:
https://www.uipath.com/kb-articles/excel-automation-delete-duplicate-rows .

Hi can you please. Check this

Hi @acaciomelo
The code “DataTable distinctTable = dtRows.DefaultView.ToTable(true, “column1”);” will give me distinct values but I want to remove only the row which are cosecutive and keep 1 row.
example
I have a list of program to be broadcast in a day. A program will have repeat telecast also. So i want to remove the program name if they appear twice or trice consecutive only.
Like

program name
drama -1
drama -1
movie -1
drama-1
drama-2

output
drama-1
movie-1
drama-1
drama-2

I hope this time I am much clear with the problem statement.
Thanks

Well, in this case you could iterate the rows and check if the current value is not equal to the previous one. If they are different, then you may apply the value, otherwise you may continue the loop.

Keywords: for each row, continue;

Please, try to follow this logic and let me know. :slight_smile:

Hi,

You can use this to remove the duplicate rows

Regards
Balamurugan.S

Guys
Here is a detailed article on that :slight_smile:
# How To Remove Duplicates From Datatable In UiPath

Regards,