Get date from excel, sometimes blank

I want to import a date from a cell in Excel into uipath and store it in a variable.

On import, I convert the date to datetime from string.

However, when the field is blank, and sometimes I need it to be blank, it errors.

Error: String was not recognized as valid DateTime.

I would keep it as a string, but excel appends the time onto the date and I only want the “MM/dd/yyyy”

Hi @SteveTin,

Welcome to community.

You can check if it is empty by putting a condition before it.


Thank you!

I’m trying to enter an if statement into my value box of the imprint arguments, but it doesn’t seem to be working. What did you have in mind?


If(Config(“Date_Start”).tostring is nothing,“True”,“False”)

You can assign the values ​​you want to the true false fields.

I hope that will be useful @SteveTin.

@SteveTin Can you share sample input excel. Also, can you let me know what is the format of data that you were trying to read from the excel cell

@SteveTin Try below expression to get the date format in assign activity.Ref attached workflow (9.9 KB)

Variable of type string Output = DateTime.ParseExact(CellValue,"M/d/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString("MM/dd/yyyy")
  • Cellvalue variable contains the data that you are reading from an excel
  • M/d/yyyy is the format of date present in excel (change this accordingly, ex: if it is dd/MM/yyyy change here in the same way)
  • Print the output in a message box and check the results

  • Also, once you get the data from an excel take if condition to check if the variable has any value or empty
  • Take if activity with the below condition

If it is true then don’t do anything, otherwise get the date format value

Thank you both for your help! Its working now.

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