Remove Duplicate rows based on primary key

Hi Team,

Below is my input excel

image

From this, I want to filter out unique names and enter in the next sheet like this

image

I was trying to do this programmatically but it is getting complicated, please suggest is there any easy way to do this?

1 Like

Hi @Deeipauk

Did you try to use this activities.

image

also you can use the group by function in dattable to get your desire output.

cheers :smiley:

Happy learning :smiley:

3 Likes

@Deeipauk - you can try below -

  • use Read Range activity to read the data from Excel file and will give you output as DataTable and like ‘dtEmpDetails’.

  • Create a new datatable variable like dtFilterdEmp

  • use assign activity and write below code to filter the data

dtFilterdEmp =  dtEmpDetails.DefaultView.ToTable(true, “Name”)
**or** 
dtFilterdEmp = dtEmpDetails.Asenumerable().Gropyby(Function(a) a.Field(of string)(“Name”)).Select(Function(b) b.First()).CopyToDatatable()
  • use Write Range activity and pass that dtFilterdEmp to write into new excel file.
2 Likes

Hey Thanks for your response,

Duplicate row works when all columns are same but for me based on Name I need to filter other columns are already different, so this is not working

1 Like

Hey thanks for your response, this is quite simple and is working fine

1 Like

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