Need to filter Excel Data based on Date

datatablevaraible.AsEnumerable.where(Function(x) x(2).ToString.Equals(datyes)).Copytodatatable

dateyes is a variable

image

here your input date format is coming in the form of M/dd/yy e.g 5/25/23

Hi @Shiva_Nikhil This is not working. Can you check my attached flow in above message.

Try to change column name(Order Date as Order_Date) and run it .
use this create a dataTable variable FilteredDt=YourDTvariable.Select(“Order_Date='”+DateVariable+“'”).CopytoDataTable

DateVariable=DateTime.Now.AddDays(-1).ToString(“MM/dd/yyyy”)
DateVariable datatype is string

Hi @Sai17 Actually this code is working ReadDt.AsEnumerable().Where(Function(row) (row(“OrderDate”).ToString = InputDate.ToString)).CopyToDataTable()

If i don’t have 1st row empty. I need only 1 thing to add in this code is to eliminate that null row and proceed with filter that data.

you can use hide row activity. you can download it from manage packages . search balareva easy excel activities. there you can find it

@Sai17 My client side they are very strict they won’t allow for any Other outside packages.

Datatable.AsEnumerable.where(Function(row) row.ItemArray.All(function(col) not string.IsNullOrEmpty(col.ToString))).CopyToDataTable
You can use the below Linq query to delete rows which has empty cells in a datatable
Use assign activity and assign the above query to a new Datatable.

Hide Excel Rows in UiPath | Excel Automation UiPath - YouTube this video might be helpful to you

give a condition that if row is empty then perform this action likewise

Thnks @Shiva_Nikhil I will try this once.

1 Like

@Sai17 I will go through this once.

Hope this LINQ would be helpful.

(From d In DT.AsEnumerable.Skip(1) where DateTime.Parse(d(1).tostring).Date = now.AddDays(-1).Date select d).CopyToDataTable

Thanks,
Najeer Shaik.

@Learner007 Hope this LINQ would be helpful.

(From d In DT.AsEnumerable.Skip(1) where DateTime.Parse(d(1).tostring).Date = now.AddDays(-1).Date select d).CopyToDataTable

Thanks,
Najeer Shaik.

Hi @Shaik_Najeer i will try this once and update you