Delete Datarow1 in excel

Hi Team
how to delete 10 day old data in excel Like In excel I have date column , My requirement is that bot will read excel and read last input date data in excel and calculate the privious last 10 day date and search that day in excel and delete that date data row in excel

Hi @Kuldeep_Pandey

Can u share sample input file here.

Date.xlsx (9.6 KB)
This is my Sample file Like last date is 11 march now I have to delete data lastdate(-10) data rwo like 1 march data from excel

Hi @Kuldeep_Pandey ,

Could you check with the below Expression :

DT = DT.AsEnumerable.OrderBy(Function(x)CDate(x("Your Date Column").ToString)).Take(DT.Rows.Count-10).CopyToDatatable

Here, DT is the data read from Excel sheet as Datatable.

Write this Modified datatable to a new sheet and check if it is providing the right result.

1 Like

Not working
Its not deleting any data row

Hi @Kuldeep_Pandey

Give a try to this
FilterDate.xaml (10.5 KB)

Output File
Date.xlsx (10.8 KB)

Hope this helps.

1 Like

@Kuldeep_Pandey

Please try like this

dt = dt.AsEnumerable.Where(function(x) Cdate(x("Posting Date"))>Now.AddDays(-10)).CopyToDataTable

cheers

1 Like

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