Excel Automation :Comparing dates in excel with current date and if matched fetching the associated job name in other column


I have a new requirement where I need to read dates from my excel sheet (dates are in column2 comma separated) and compare the date with current system date. IF date matches with any of the column in excel sheet get the jobname and based on the jobname trigger the job flow.

How we can have flows for different jobs and trigger the appropriate flow based on the match flow .Will switch case work ?

MY excel looks like below

Jobname Dates
job1 1/2/2018,2/2/2018,3/3/2018
job2 1/4/2018,2/5/2018,3/6/2018
job3 1/10/2018,2/7/2018,3/9/2018
job4 1/11/2018,2/12/2018,3/1/2018

Can someone please share a flow on how to get this done. I have tried different solutions but did not work.

I tried implementing the pseudo code shared

“row(“Dates”).ToString.Split(”,“c).Where(Function(d) IsDate(d.Trim) ).Select(Function(d) CDate(d.Trim) ).ToArray.Contains(Now)”

but was not able to do it in uipath as I am pretty new to uipath and still learning lot of stuff.

Can somebody help me with sample workflow it will help me.

Thanks for your time and support

@mahendra1185 u have 3 dates, u should compare all 3 dates with current date?

1 Like

Thanks Manju
This dates are comma separated in each row and there can be any no of dates in each row.

My requirement is I need to check each row with the current date and whichever row matches with current date get the jobname from that row. Based on the jobname retrieved invoke the workflow for that respective job.

@mahendra1185 can u tell date is in which format?

1 Like

Thanks manju … the dates would be in mm/dd/yyy format and separated by comma in single row.

@mahendra1185 I will check that and let u know.

@mahendra1185 Try below workflow and let me know.

date1.xaml (12.5 KB)

Book1.xlsx (7.8 KB)

1 Like

Thank you so much for your help.
Checking them. Will let you know.

Thank you so much Manju. Your solution works perfectly.

One more question based on the job names matched I have invoke different workflows.
Do ?I need to use switch case ?

@mahendra1185 if condition are very less like 2 or 3 dont use switch condition, if conditions more then that go for switch condition. And one more thing how many dates will be there Dates columns of excel, if more than 3 dates in every row then workflow can be optimized further to some extent.


@Manjuts90 you are really helpful. Thanks.
I have 4 conditions and also the comma separated dates can be 12 in each row. Its like once evey month the job can run.
If the dates are 12 how it can be optimized

@mahendra1185 use break condition if condition , once date is matched in particular row, it won’t check for further dates in that row, so that number of times inner for loop and if loop execution will be reduced

1 Like