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
image

Condition to compare:

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

Please guide me on this.

Hi @lakshmi.mp

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

In If Condition
      End_dataRow>=Current_date

@lrtetala ,


Can you check this screenshot.

@lakshmi.mp

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

Hi @lakshmi.mp

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

Hi @lakshmi.mp ,

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?

Thanks,
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 @lakshmi.mp

Place this in if condition @lakshmi.mp

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

@lakshmi.mp

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:

     End_dataRow>=CurrentDate

Hope this helps!!

@lakshmi.mp

Check on this xaml

BlankProcess12.zip (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

@lakshmi.mp

Are you tried this

@lakshmi.mp

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…

@lakshmi.mp

Can you please confirm what you are trying?

If this condition is true
End_dataRow>=CurrentDate
what is the next step

@lrtetala ,
if:

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 @lakshmi.mp ,

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.

Thanks,
Sandhiya P

@sandhiya.ppp ,

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