StringConverter cannot convert from System.Double


#1

Hi, I am reading 2 cells from an excel file. The first cell is number in text format and goes from 01 to 12. The second is a formula that shows the year. So the value is “2017” and has its format set to general.

The first read works fine and the second one gives me the following error: “StringConverter cannot convert from System.Double.”

Both output variables are set as “String”. Can some one help me out?


#2

Format in Excel file is just used to determine how to DISPLAY data on EXCEL FILE. It doesn’t affect data type in datatable in UiPath.

I guess UiPath recognizes columns as Double when the cell only contains numbers (but if it starts with zero and is followed by another number, UiPath recognizes it as String)

Therefore, you have to set data type of the variable for year to “Double” or “GenericValue”.


#3

When I change the data type from the year variable for Double or Generic, I get a compilation error since the output value of “Read Cell” is “String”.


#4

Please completely delete output value of Read Cell activity and enter GenericValue type variable name.
You must be able to use GeneicValue as output of Read Cell since UiPath doesn’t know what type of value is coming into the variable!


#5

Tried it. Still not working.


Use Existing Workbook Activity
#7

Thnx for the answer.

Where should I use this code?


#8

Generic type should work. i tried now.
Could you please remove the ano from output field and come out and moment later pass again.
ReadNumber.zip (8.4 KB)


#9

Hi,
facing a similar problem. Can you please tell me which option to select exactly to get the double or generic data type. I am selecting system.double by going to “browse for types” option and upon execution i am getting a validation error in the workflow.

Thanks.


#10

Hi,
I solved this error using cint keyword that cast the variable ano to int. After you achieve the year from the excel file you could use assign activity and cast the achieved data to int. I hope that could be useful.