I need to filter list of one year and one month before date in excel sheet from current date and save in same excel file in different sheet.
(For Example, today’s date is 15-12-2021…I have to filter from 15-11-2020 to 15-12-2021) in Excel sheet.
I tried so many ways, but it can,t work. If anyone knows how to do that, please share with me.
Hi @lokeshkumar.k Do you have any sample input?
Also You can checkout this thread @lokeshkumar.k
You can Try with LINQ expression
DtOutput → System.data.DataTable
DtOutput = DtreadFull.AsEnumerable.Where(Function(x) Not(String.IsNullOrWhiteSpace(x("Column Name").ToString)) AndAlso (CDate(x("Column Name").ToString)<(new DateTime(Now.Year,Now.Month-12,1)))).ToArray.copytodatatable
yes…I have sample input file
okay can you send that here?
I have to filter from this excel sheet from current date.
Read Range Activity Output
Can you share the Output for this Input file @lokeshkumar.k
I have to filter the list of one year one month back dates from current date from this excel file.
There is two column name mentioned in the query. but i try to filter the date compared to current date only
please suggest any query for this one.
DateTime.Now.AddMonths(-13)<ExcelDate and DateTime.Now>ExcelDate
ExcelDate is in Date format of your excel date data
and I need to filter one year back also
This Conditions allow only past 13 months data and current month data
DateTime.Now.AddMonths(-13)<=ExcelDate and DateTime.Now>ExcelDate
This Conditions allow only past 12 months data and current month data
DateTime.Now.AddMonths(-12)<=ExcelDate and DateTime.Now>ExcelDate
Without give column name. how its working ?
You have to pass column name in “ExcelDate” variable as a date format