How to find Latest record in excel

I want to extract only recently updated records from excel while bot triggers. I am trying with filter data table activity. Any one can help me on this.

@Hareesh_Kumar

Welcome to our UiPath community.

Add one more new column at the end called Status. Update the status as successful or failed post processing the record. So that you can easily identify the newly added records(whose status will be empty).

1 Like

Hi @Hareesh_Kumar ,

It depends on how you detect these recently updated records.
If there are column(s) which are initially empty, then later on get filled with data, we can filter on the basis of those columns like so:

image

Kind Regards,
Ashwin A.K

1 Like

Hi

Welcome to uipath forum

There are two possible ways to do this but it requires some tweaks with the code

  1. First approach is to have a separate folder apart from the main folder
    Where main folder actually has the file with data before it is updated
    And separate folder named as temp folder will have the updated file

— then read both the files and have it as dt1 and dt2
Use the below expression to get the unmatched records which are the newly updated records

dt = dt1.AsEnumerable().Except(dt2.AsEnumerable(),System.Data.DataRowComparer.Default).CopyToDataTable

Or

  1. Second approach is to use a column atlast in that same excel file named as Status
    And leave the status column as empty for the newly updated records

Now use a Assign activity like this and get the new updated records

dt = dt.AsEnumerable().Where(Function(a) String.IsNullOrEmpty(a.Field(of String)(“Status”).ToString.Trim) ).CopyToDatatable()

Cheers @Hareesh_Kumar

1 Like

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