Remove duplicate data from Excel file

I want to compare two Excel files and remove duplicate values. What should I do? Below is an example.

Hi @Benimaru ,

Try using the Remove duplicates activity. Placing the link point to official documentation of the activity please go through the same and configure accordingly.

Happy automating.!

Thanks,
Gautham.

In addition, you can also invoke the following LinQ, that will only keep those rows which are exactly the same, on all its columns

Assign:
Left = resulting DT
Right = dt_input.AsEnumerable().Distinct(DataRowComparer.Default).CopyToDataTable

BR,
Ignasi

1 Like

@Benimaru

Output is ready!

Assign Activity:
dt_Output(This is new Datatable variable) = dt_Input1.AsEnumerable.Except(dt_Input2.AsEnumerable(),System.Data.DataRowComparer.Default).CopyToDataTable

Note: If above LinQ throw an error just swap the input datatable variables.

Screenshot for your reference:

Happy Automation…!

Regards,
Ajay Mishra

1 Like

@Benimaru

thank you

But there is one problem.

If there is no data in the excel file table, an error occurs. How do I terminate a run when there is no data?

Hey @Benimaru

Just surround the activity by try catch and put a assign activity as mentioned in the screenshot.

In Assign Activity:
dt_Output = dt_Input1.Clone

You can put any of the expected input datatable variable in right side of assign activity!

Regards,
Ajay Mishra

1 Like

@Benimaru Just check this one, I have edited a bit!

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