Filtering dates in Excel / CSV

Need help.

I have an excel file with several dates, I only need to data for the current date minus 1, meaning yesterday.



Try the following code

dt.AsEnumerable.Where(Function(x) CDate(x("yourcolumname").ToString.Trim).Day.Equals(Now.AddDays(-1))).CopyToDataTable



What is x in Function(x) and Cdate(x) ?

an internal variable within the function that will allow us to call column names

Here is the sequence of UiPath code where do I place this command?

@Henson_Ibon you add a assign activity below filter activity and add the command in it. Replace ‘dt’ to ‘allstatusDT’ and ‘yourcolumnname’ to actual column name.


Followed the solution but I get an error.

Please check if the source data table has any data in it, else it will throw the above error.
In such case you can add a if else activity condition before the assign activity. In the condition add the above command, replace the “.CopyToDatatable” to “.ToList.Count > 0”