REmove duplicates from datatable excel

Hello friends,
@AshwinS2 , @arivu96, @Rammohan91, @balupad14, @Florent_Salendres, @vvaidya, @Palaniyappan, @loginerror, @MAHESH1, @Manjuts90


how ot rmeove duplicates from a datatable read from an Excel file?
I tried with REmove duplicates but doesn’t work.
Cami :slight_smile:

2 Likes

kindly try with remove duplicate rows activity
or
we can use this expression
dt = dt.Asenumberable().Group(Function(a) a.Field(of string)(“yourcolumnname”).ToString).Select(Functions(b) b.First()).CopyToDatatable()
Cheers @CamiCat

Hey @CamiCat,

I had a similar issue, have a look through some of the replies to one of my posts.

If you have any questions, feel free to ask :slight_smile:

Thank you so much @Palaniyappan.
For the second option how in case of multiple Columns to insert as columnname?
Thank you,
Cami

but for this case REMOVE DUPLICATE ROWS will work actually
where you facing any issue in that
Cheers @CamiCat

When I write it back in excel it appends the row continuosly so doesn’t cancel the duplicates.
Cami

can i have that excel sample if possible
Cheers @CamiCat

Indice_13-11-2019.xlsx (8.6 KB)
This one :slight_smile:
Can you please help me?
Cami :slight_smile:

here you go
if this is not the excel you want
kindly share the output excel you want
cami.zip (16.3 KB)

Cheers @CamiCat

1 Like

Hi @CamiCat

Try this query

(From p in dt.Select() where( From q in dt.Select() where string.Join(",",q.ItemArray).Equals(string.Join(",",p.ItemArray)) Select q).ToArray.Count>1 Select p).ToArray.CopyToDataTable()

Duplicate records from the same data

And then use remove duplicate rows

Thanks
Ashwin.S

2 Likes

Thank you,

I would like only one row at the end, if at the beginning there are multiple.
Cami

Hi @CamiCat,

To remove duplicate from excel you can use this one . I don’t know if it is useful or not…

Regards
Balamurugan,S

1 Like

Thank you @Palaniyappan.

I would like to have file with no rows duplicated.
With your workflow the excel file, in case of 4 identical rows, maintains them at the end.
How to have a file ith no duplicates, but only one row?
Cami :slight_smile:

Usually duplicates in excel will be searched along each rows in it
So to group them we can take a common column, a primary column based on that we can group them
Is there any column of such kind

Cheers @CamiCat