How to delete dublicate values in excel. based on 2 different columns dats

How to delete dublicate values in excel. based on 2 different columns data.

we can use a group by for detecting the duplicates


dtResult =

(From d in dtData.AsEnumerable
Group d by k1=d("Case Number").toString.Trim, k2=d("Receipt Number").toString.Trim into grp = Group
Where grp.Count = 1
From g in grp
Select r = g).CopyToDataTable()

Also have a look here where also a Non-LINQ approach is described:

1 Like

bro if u dont mind, can i have it in c#

did you get work on the other LINQ statement or are the assign statements still blocked? If there are still blocked we would recommend implementing the described non-LINQ approach. Maybe also good

C# would a like as:

.GroupBy( d => new { col1 = d["Case Number"].ToString().Trim(), col2 = d["Receipt Number"].ToString().Trim()  } )
.Where(g => g.Count() == 1)
.SelectMany(x => x)
1 Like

HI @MitheshBolla ,

Try this one!


as i am working in c# its trowing error.

as mentioned we would recommend focusing on the infrastructure that C# and LINQ will be in general reliable work. As a workaround, you can implement it with the Non-LINQ approach

1 Like

should i import any packages?

have a check on updated LINQ from above

1 Like

All errors gone bro, but one is remaining

Perfect, looks like a dot net infrasctucture issue.

Just have a check on Forum search for similar issue. Otherwise share the details like:

  • uiPath version
  • targetframework from project (depending on versions)
  • used UiPath.System.Activities version

Maybe someone can replicate or UiPath will get looped into the discussion

1 Like

uipath version = 2021.10.5

uipath.system.activities = 22.4.1 (its suggesting me to update to latest )

@supermanPunch , can you help with this c# code, failing at one step, while trying to delete dublicate values in datatable of two columns

Hi @MitheshBolla ,

As Peter mentioned, I do think it is a kind of bug that has been found when using c# as the Language.

I did try with the other method of grouping as well, where it ended up having the same error.

It needs to be directed to the UiPath Team for the final conclusion.

But before that do try with the Latest Packages/Dependencies. To Check if it was corrected in the later releases.

Note: This happens when trying to group with more than one Column. No Error found when grouping with One Column.


with the valuable input from Arpan maybe you can do a trick like:

.GroupBy( d => d["Case Number"].ToString().Trim() + "_" + d["Receipt Number"].ToString().Trim() )
.Where(g => g.Count() == 1)
.SelectMany(x => x)

still error,

bro can u give dublicate rows delete when there are dublicates in Receipt number column?

that is enough . with one columns its not issue right.

sorry had a type and did correct the statement

1 Like

Still operator issue only bro,

used + for concatenation it was accepted by compiler. check updated statement from above

casenumber clolumn and receipt number column,

if the both column values are present in excel then its dublicate. so i want to delete one row .

Hilighted yellow are dublicates