im using the Read Cell activity to get a value from an excel, save it into a variable and later post it via the Type into activity. So far it’s working great for excel cells that contain text but now I encountered one that contains a number. It seems like UIPath is interpreting the number as a double instead of a string, resulting in an exception (Message: StringConverter cannot convert from System.Double).
Is there a way to cast the output argument (Result) of the Read Cell activity into a String and assign it to my variable?
Basically looking for something like: MyVar = Converter.toString(Result)
This would include setting my variable to type “Double” right? Sadly this creates a new error in the Read Cell activity: “Option strict on does not allow implicit conversion from double to string”. No idea what “option strict on” is or why there should be an implicit conversion
You can use the Generic type variable. It is meant to automatically “adapt” the type to your needs for basic operations.
You can indeed first set your type of the variable to Double and use the variable with a .ToString whenever you want to type it in.
Convert the number to text directly in Excel so that UiPath activity will read it as text
This comes from the fact that Read activities apparently automatically try to detect the type of the value they are reading. I actually thought it was only the case for Data Tables, as those need their columns strictly defined upon creation. The fact that Read Cell acts the same is a bit confusing to me, but I am sure there is a logic to it as well.
Personally, I think one should be able to customize it in Properties of the activity.
Either way, I am sure it will read it as text if you convert the values to text using the “Text to Columns” trick:
No no you got me wrong there. I did set the variable type to Double and then got an error in the Activity with the text "“Option strict on does not allow implicit conversion from double to string”.
However recreating the variable fixed the issue so I guess it was some small bug within the Validation/UIPath software.