How do I get only Duplicate Rows From the Excel Data Column?


I Want to get only duplicate Rows From the Coluumn.

Look at the Screenshot of Input Data


Output Which I want


“fgh” is not Fixed value it will be Dynamic but yes value will same


OutputDT = From row In dtData.AsEnumerable()
Group row By key = row(columnName) Into Group
Where Group.Count() > 1
Select Group

Assign Activity
dtResult =

(From d in yourDataTableVar.AsEnumerable()
Group d by k1=d(1).toString.Trim into grp=Group
Where grp.Count > 1
Select g=grp.toList).SelectMany(Function (x) x).CopyToDataTable
1 Like

Hi @kishan.savaliya

=> Use the read range workbook to store the data in excel in a datatable. Output - dtExcel
=> Create a datatable variable called dtDuplicate in the variables panel.
=> Take a assign activity in the Save to field give the dtExcel variable in the save to field give the below linq expression.

dtDuplicates = (From row In dtExcel.AsEnumerable()
                Group row By columnValue = row("ColumnName") Into Group
                Where Group.Count() > 1
                Select Group(0)).CopyToDataTable()

=> In the place of Column name give the column name you required.
=> Use the write range workbook activity to write the dtDuplicates variables in to other excel file.

Hope it helps!!

Thanks @ppr for Solution!!

Thank You all for the Reply!!

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