How to pick last 2 days or last 2 or 2 month data from excel


I have an excel where i have a raw data of last 6 month or more. so i want to pick a particular range like (last 2 days, last 15 days, last 3 month) data

please advice how can i get this dataNew Microsoft Excel Worksheet - Copy.xlsx (34.7 KB)

Hi @manish_patel,

You can use the below LINQ to filter the datatable.

(From row in dt.AsEnumerable().Where(Function(x) Datetime.ParseExact(Convert.ToString(x(1)), “MM/dd/yyyy hh:mm:ss”, System.Globalization.CultureInfo.InvariantCulture)>= Datetime.Now.AddDays(-3)) select row).CopyToDataTable

Its always better to assign Datetime.Now.AddDays(-3) to a variable and using the variable in its place.
You can modify the “AddDays” method to “AddMonths” and can play around.
I have used the “DISPATCH DATE” column but this column can also be modified if needed.

Happy coding! :slight_smile:


I am beginner on uipath so can u please create a test workflow and share with me

so i can understand that things