Compare today date and excel date column then write new sheet

hi ,
i have an excel data

Name Activity ID DateofCompletion
Orange 32 23/05/2025
Apple 4 23/09/2025
Apple 5 14/11/2025
Orange 7 23/09/2025
Papaya 8 29/07/2025
Papaya 9 13/12/2025
Banana 1 23/11/2025
Banana 2 13/10/2025
Banana 4 17/05/2025
Papaya 12 24/08/2025
Orange 11 29/12/2025
Apple 10 28/04/2025

i want to compre with today date 11-12-2025 to excel date column . if today date > excel date write new sheet if not write those rows into new sheet

@anand_kumar4

Try using this in assign activity

Past Dates DataTable

dtPast = If((From row In dtInput.AsEnumerable()
             Where DateTime.ParseExact(row("DateofCompletion").ToString.Trim, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture) < todayDate
             Select row).Any,
            (From row In dtInput.AsEnumerable()
             Where DateTime.ParseExact(row("DateofCompletion").ToString.Trim, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture) < todayDate
             Select row).CopyToDataTable(),
            dtInput.Clone())

Future Dates DataTable

dtFuture = If((From row In dtInput.AsEnumerable()
               Where DateTime.ParseExact(row("DateofCompletion").ToString.Trim, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture) >= todayDate
               Select row).Any,
              (From row In dtInput.AsEnumerable()
               Where DateTime.ParseExact(row("DateofCompletion").ToString.Trim, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture) >= todayDate
               Select row).CopyToDataTable(),
              dtInput.Clone())

Use Write range activity to write past and future datatables in the respective sheets

2 Likes

@anand_kumar4

if you want to do it in excel only without reading

then you can use filter excel activity and filter with todays date greater and less than and then use copy paste range activity to copy data or use delete rows to delete the filtered rows etc

filter with Now.ToString("MM/dd/yyyy")

if your excel date format is different then change

cheers

1 Like

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