StringConverter cannot convert from System.Double

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?

4 Likes

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”.

14 Likes

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”.

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!

8 Likes

Tried it. Still not working.

1 Like

Thnx for the answer.

Where should I use this code?

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)

2 Likes

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.

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.

2 Likes

Had the same system.double error, your comment worked for me, thanks a lot!

1 Like

Hi
Please follow this

3 Likes

Thank you @a-taniya. Your answer really helped me too.

1 Like

Thank you a-taniya. This is the right answer for me

I set it to double and it worked fine. Than

Thank you, @a-taniya. I used your solution and it worked well.

How to set it to double using browse and select .net type function can you explain/
There are many things to select

Thank you @a-taniya . Ur solution helped me.

Thank you very much…this solved the problem i was having…

Worked for me. Now I have to convert GenericValue into String :face_with_raised_eyebrow:

you can convert the double to string using :

double_name=Cstr(double_name) .

example :

vin= 34587.1
vin = CStr(vIn)
vin=“34587.1”