UiPath copies number from Excel as 1.000,00, pastes in web browser as 1000.00

Then I get an error, because the browser system won´t accept dots as decimal points.

I am reading the Excel cell into a GenericValue variable. Then I am using a type activity to type that variable into the browser cell.

I tried using “variable” and also “variable.tostring”, in the hopes that adding “tostring” would make it type the text exactly as had been read.

If instead of GenericValue type, I set it as Int32, then I get a " Int32Converter cannot convert from System.Double" error.

ok… tried setting variable as “system double”.

I suppose a “system.double” variable is a number which is not an integer??Why is this variable not listed in the UPath variables documentation and why is it not a main type of variable?

In fact, I do not understand why System.Double and Generic are not listed as main types of variables…

But anywa… changed to system double type. Still the 1000,00 is pasted as 1000.00

Also, while pasting the System.Double variable into the browser, I still must used variable.TOSTRING, otherwise it says "option STRICT ON doesn´t allow implicit conversions of double to string.

what?

Hi
If you want to type as it is then we can get the value directly from excel as a cell value with READ CELL or READ RANGE and type with TYPE INTO activity within FOR EACH ROW loop

We can validate this either with a writeline activity so that in seeing that we can know how the value is been obtained with its format

Cheers @Rogerio_Penna

getting the value from Excel with READ CELL and then using TYPE INTO is exactly what I have done.

It reads as 1000,00 and “types into” as 1000.00

no need for Writeline activity. In Debug mode I can see the variable value after it reads the cell.

And the value is also using a dot as a decimal separator, when it should be a comma.

but i tried the same
its giving the correct value
Kindly have a view on this


image

Cheers @Rogerio_Penna

is your Excel format SET to using commas as decimal separators, or Excel understood your 1.000,00 as a TEXT?

Because if I type 1,000.00 in my Excel, Excel will not understand it as a number, but as TEXT.

The inverse is true, so it may happen that at using a Generic Type variable, UiPath is copying 1.000,00 as TEXT and thus posting the TEXT 1.000,00.

To test this, you should try making a number operation with that value, like adding 1000 to it.

See if you get 2000 or an error, saying you can´t add a number to a text.

This is probably culture related problem. Can you try running this activity to see what your culture is set to:

image

where is this “culture” activity?

edit: it seems I have to install package System.Globalization 4.3.0 to have this CultureInfo activity. However, I am getting an error trying to install this package.

Let’s skip checking the “Culture” of my UiPath and let’s assume it’s set to the wrong “culture”. How do I fix it?

You should not have to install, just include the namespace:

System.Globalization.CultureInfo.InstalledUICulture.

My culture is en-US

You can try using an assign and set the culture at the start of your workflow.

To should be: System.Globalization.CultureInfo.CurrentCulture
and value should be: New System.Globalization.CultureInfo(“en-US”)

Edit:
image
As you can see in the screenshot above UiPath will convert the cell value from excel to Double instead of string. Therefore, depending on your Culture the “.” and “,” will mean different things. Hope this helps, theese kinds of problems can be very tricky, to me atleast :slight_smile:

"You should not have to install, just include the namespace:

System.Globalization.CultureInfo.InstalledUICulture."

sorry, where should I do this? At the Activities Panel, if I type that, I get “No Result Found - Search at Available Packages” message.

However, I can write those in the ASSIGN activity.

BUT I get this error:

@Rogerio_Penna - @aeklof is recommending that you use a “Message Box” activity with the “CultureInfo.InstalledUICulture” text inside the Message Box.

ok, so I get a pt-BR

Brazilian Portuguese. That was expected. But Brazilian Portuguese AND Portugal-Portuguese should have commas as decimal separators.

edit: when writing “cultureinfo.CurrentCulture” inside the Message Box, I get an empty message box…

Try this… System.Globalization.CultureInfo.InstalledUICulture.ToString

no need, as I mentioned above, after using your suggestion of putting it inside a Message Box, I got the message that I have pt-BR installed.

Which I already knew. But pt-BR should have commas as decimal separators!

Have you tried as @aeklof mentioend above

As you can see in the screenshot above UiPath will convert the cell value from excel to Double instead of string. Therefore, depending on your Culture the “.” and “,” will mean different things. Hope this helps, theese kinds of problems can be very tricky, to me atleast :slight_smile:

When assigning your variable to the data found in the Excel sheet. Check that the Variable Type is set to double.


I tried using “variable” and also “variable.tostring”, in the hopes that adding “tostring” would make it type the text exactly as had been read.

Try this… Write Line = (Convert.ToDouble(variable)).ToString

Errr… I am not sure, but I think what Aeklof suggested is the same I posted on post #2?

The issue is when you are converting from Object to Double.

See this thread. https://stackoverflow.com/questions/2583362/how-to-convert-string-to-double-with-proper-cultureinf

Check the post with 61 up votes. Might be useful for what you are trying to do

ok… let’s go by parts. The complexity of variables in UiPath are it’s weakest spot imho.

Let me try to parse your answer…

1 - Change variable to double on variables panel
2 - read cell activity - just read the Excel value and put inside the variable
3 - TypeInto activity: text should be “(Convert.ToDouble(variable)).ToString”

is that it? I will try it

After doing some googling i think its an issue with the way the data from the excel table are being converted.

@Palaniyappan @bcorrea - Have you ever dealt with CultureInfo and converting of types? If so, can you provide some insight?

ok, no use doing this. Again, the problem is that when it COPIES from Excel, the variable is already stored as 5555.55 format instead of 5555,55 format. Doesn´t matter if it’s doube or generic or int32.

Maybe I should try copying the variable as STRING and converting it to number when pasting? Maybe copying as text will copy it correctly?