DT Remove Duplicate Row does not work

Hello, I’m still quite new to the area.
I cannot delete the duplicates from a table. If I enter the DT they just won’t be deleted.
it’s so easy you can’t actually make any mistakes, but it doesn’t work.
i use the remove duplicate row activity…


please a more detailed description of what I have to do so that I understand it :slight_smile:


You can use Read Range activity to read the excel->Properties create a Datatable Variable

Once Done Use Remove Duplicate Rows activity and input Datatable Variable and create another Datatable variable / Use same Datatable table variable

You can use Write Range activity to write back to Excel

Hope this may help you


no that doesn’t help me. I read in a larger table beforehand and then remove some columns. the result in the picture is then left. But I would need that for further processing without duplicates.

use write range and write to another worksheet

does not work too. I already copied it into a second DT, but without result. The command does not work.

if a write range writes into a worksheet already containing data and has less datarows as before
(e.g readin 20 rows - after remove duplicates 5 rows) then we do see th 5 rows from the second write range and the remaining 15 rows from before of write range.

Therefore we were asking for writing it into second worksheet, but did not mentioned a second datatable. Sure, you can also debug and inspect the dt after remove duplicates.

If remove duplicates activity is not working as expected just check if excel is not containing blanks on the end of some values and this maybe is reason for failing.

In such case we can handle duplicate removal with a LINQ Statement

after hours I found a solution :slight_smile:

First build a “KEY” from the two columns:


and then explicitly removed duplicates from the key column:

DTmeins=DTmeins.AsEnumerable().GroupBy(Function(i) i.Field(Of String)(“key”)).Select(Function(g) g.First).CopyToDataTable

if someone has the problem again, that would be my solution :slight_smile:

Perfect, well done. The approach falls into the category from below quote