I want to remove the duplicates in this excel by using the time column, If duplicates found in the Policy column i want to keep the recent one only & need to remove the old one using time. How to do this ??
Attached the screenshot & Excel File
Hey @Praveen_Vs ,
To do this you can follow these steps.
1.Initially Read your Input Using "Read range workbook " activity
2. Sort the input datatable in descending order (Using “Time” Column)
3. Now all the recent timings will come first .
4. Then you can group the data By taking the first value(That is ignoring the duplicate values)
-Keep preserve formatting true while reading the Excel
Try the following:
(From row In dt.AsEnumerable() Group By policy = row("Policy").ToString() Into policyGroup = Group Let latestEntry = policyGroup.OrderByDescending(Function(r) DateTime.Parse(r("Time").ToString())).FirstOrDefault() Select latestEntry).OrderBy(Function(r) DateTime.Parse(r("Time").ToString())).CopyToDataTable()