Read cell in exel

Hello, how can i get the robot to read and take a cell from excel which value is derived from a formula?

1 Like


You can use Read Cell activity and pass cell range from where you want to read it.

yes, however, an error appears in the read cell. the cell in question is a date in dd.MM.YYYY format which is obtained with a formula. the output variable is of type

set your output variable to type Object

e.g. name of output variable (Type object) = cellOutput

then use assign activity to convert it to system.datetime

cellOutputDate = DateTime.ParseExact(cellOutput.toString, "dd.MM.yyyy", nothing)


Hope the below steps would help you resolve this

  1. Use a excel application scope and pass the filepath as input

  2. Inside the scope use a READ CELL activity and getting the output as stroutput

If that string output is in format dd.MM.yyyy and if you want that in Datetime type of variable then use a assign activity like this

date_output = Datetime.ParseExact(stroutput.ToString.Trim, “dd.MM.yyyy”, System.Globalization.CultureInfo.InvariantCulture)

This will convert to Datetime variable

Cheers @pl.rusinov

1 Like

so far so good. but the date in excel in Date format (yyyy-MM-dd). The output variable of the read range is in DateTime format. in a test in the message box it is generated in the format dd / Mm / yyyy hh: mm: ss. the goal is to change the shape of yyyy-MM-dd.

date_output = Datetime.ParseExact(stroutput.ToString.Trim, “dd/MM/yyyy HH:mm:ss,nothing").ToString(“yyyy-MM-dd”)

Hi @pl.rusinov ,

Usually when dealing with Excel, we store cell values into a variable of type UiPath.Core.GenericValue, since we can’t say for sure with what datatype the values are stored in excel.

Once you retrieve the item, you can simply convert it to string, and then parse it to DateTime before performing the required conversion like so →

DateTime.ParseExact(gen_variable.ToString,"yyyy-MM-dd hh:mm:ss",Nothing).ToString("yyyy-MM-dd")

However, if the value is retrieved as DateTime itself, then you shouldn’t have a problem with directly parsing it like so →


Dates can be tricky to work with(I get frustrated with them too!)

I’d recommend testing out various scenarios in the Immediate Panel. Its an invaluable resource for UiPath Developers as it gives us a much needed insight into the working of our codes.

If you get stuck anywhere, we would appreciate it if you could include few screenshots of the test message which contains the date, and any other relevent information regarding the process so that we may be in a better position to assist you.

Kind Regards,
Ashwin A.K

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