How to compare the current date with the excel file column

Hi all,
How to compare the current date with the column of excel.

Used this condition not able to write the compared data to excel.
Current date => now.AddDays(5).ToString("dd-MM-yyyy")

Column date

Condition to compare:

CDate(End_dateRow).ToString(“dd-MM-yyyy”) >= Current_date

Please guide me on this.


End_dataRow=Datetime.ParseExact(CurrentRow("Column date").ToString, “dd-MM-yyyy”, System.Globalization.CultureInfo.InvariantCulture)

In If Condition

@lrtetala ,

Can you check this screenshot.

After For each row in data tale you can please this activity


Try this:
For comparing:
DateTime.ParseExact(row("End_dateRow").ToString(), "dd-MM-yyyy", System.Globalization.CultureInfo.InvariantCulture) >= DateTime.Now.AddDays(5)

Hi ,

Hope you are doing good.

If you don’t mind, can you please elaborate what needs to be done, is today date needs to compare with date in the Excel and find the difference?

Sandhiya P

@lrtetala ,

After for each row Assign activity, then if condition placed.
Cannot assign date time to string error getting…

Change Data type to System.DateTime

Place this in if condition

DateTime.ParseExact(row("End_dateRow").ToString(), "dd-MM-yyyy", System.Globalization.CultureInfo.InvariantCulture) >= DateTime.Now.AddDays(5)

In For Each Row in datatable
    Assign: End_dataRow= Datetime.ParseExact(CurrentRow("Column date").ToString, “dd-MM-yyyy”, System.Globalization.CultureInfo.InvariantCulture)    DataType:System.DateTime

    Assign: CurrentDate= DateTime.Now.AddDays(5)     DataType:System.DateTime

In If Condition:


Hope this helps!!

Check on this xaml (67.6 KB)

@lrtetala ,
Assign: Conversion from string “14-10-2023” to type ‘Date’ is not valid.
Error for current date
Data type is DateTime for Current date

Are you tried this

Try this

CurrentDate=DateTime.Now.AddDays(5) DataType:System.DateTime

It is working

@lrtetala ,

It’s not filtering full excel sheet data writing into next sheet…

Can you please confirm what you are trying?

If this condition is true
what is the next step

@lrtetala ,

End_dateRow>= Current_date
then that data has to be written into excel.

Test123 - Copy.xlsx (23.0 KB)
This is the excel file. Please look into it.
Here New column 3 has dates current date + 5 days is the current date.
if New column 3 dates >= current date, needs to be filtered.

Hi ,

If you want to write it like a data table then you have to use Data row and add to data table activity.

  1. Build Data Table
  2. Create an Array
  3. Add data row to data table
  4. Write data table to excel.

Otherwise you can use write cell activity inside for each loop.

Sandhiya P

@sandhiya.ppp ,

here data is not filtering, can u guide me on this.
Test123 - Copy.xlsx (23.0 KB)
End date filter.xaml (13.4 KB)