Find Date Difference in Excel and Copy Data

I have 2 workbooks(WB1,WB2). I need to Copy Data from WB1 to WB2.
WB2 has a column ‘Date’ , the condition is I need to Copy all Rows if they are Greater than 48 Hours old to Current Date.

Any idea or suggestions would be appreciated.


you may need to convert date to specific formats…What is the format for date in the excel? Acordingly we may need to change the code

Hello @Gagan_Chaudhari
Please try the below code to get the date of the day before yesterday,


Store the above to a new variable, compare the dates in the workbook with the newly created variable. Check whether the dates are less than the newly created variable.



try this

Thanks for the help, but I am little confused (may be because I am new to this), since I have to use the excel how can I achieve this ?


Giving me this error
! For Each Row in Data Table: Object reference not set to an instance of an object.

dtExcel1 has any values?


are you using read range activity to read this excel. Please run in debug mode and see if dtexcel1 is having some values

My Date format is change and I am not getting the Values.
I have added the Snapshot of Expected output.
Considering Today’s Date (14 June 2022)
Date His

Can you please ‘CDATE(row(“Date”).toString)>cdate(now.AddHours(48).toString(“dd-MMM-yy”))’

Help in this?


Hi @Gagan_Chaudhari ,

Is it possible for you to provide a Sample Input data and it’s expected output in the form of excel ?

Sample Excel File
Test - Date.xlsx (9.4 KB)

@Gagan_Chaudhari ,
According to the Condition that you have mentioned above, is the Output only one row having date as 17/06/2022 ?