Read Excel to create 2 column data table and return value in second column

I am trying to read the attached Excel document and find the row with yesterday’s date (I currently have it set to DateTime.Today.AddDays(-3).ToShortDateString so that it returns 1/20/2020 since that was a holiday) and then return the value of the second column. I can’t figure out why it does not recognize the date. Instead, it just goes through each line and then finishes the process.

Federal Holiday List.xlsx (11.1 KB)

Use Lookup Data Table like this:

Thank you for the response @bcorrea. Does the lookup data table replace the need for the “for each row” portion? I am still unclear on how to create a variable for the cell value in the second column.

Hello @rgardner5564

I checked your file and recreated the same workflow the reason its not working is when you are getting the row(0).tostring you are getting value as 01/20/2020 00:00:00 with time and when you use DateTime.Today.AddDays(-3).ToShortDateString you just get the date without time…
So thats the reason its not matching split the row(0).tostring value to skip the time and then compare…

Also always log the value’s you work with for testing and future use

This is the recreated workflow check it if you didnt understand anything

rgardner excel.xaml (7.7 KB)

@rgardner5564 Just Change Condition in If Block to : Split(row(0).toString," ")(0).toString.trim=Yesterday and check

yes it does. the lookup will return for you the value and you create the variable in the Output->CellValue

Thank you @vickydas. I really appreciate the help and the fact you recreated the process for me to follow. I’ve been doing RPA development since August 2019 and have no prior programming experience so that was really helpful for me as I learn.

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