Can I output columns with type double with comma instead of dot in a csv file using standard activity “Write csv”?
Welcome to the community!!
So to understand your problem, you have bunch of values something like (1234,00) and you want to convert it to double when writing the data to a CSV right? so the comma is there instead of the dot.
Well, if the comma is there, as far as I know, it is considered as a String. So you will not be able to directly convert it to a double unless you replace the comma to the dot. In case you want to convert to double, do the following steps before writing to CSV.
Add a For Each Row activity to loop through the data table
within the loop add an assign activity and do the replacing like this
row(“ColumnName”) = row(“ColumnName”).ToString.Replace(",",".")
This will replace all the commas in that column to the dot. Now you can convert the values to double
If you are to convert through Uipath itself, you can try the below code to convert it
let know whether this helps.
thanks for your answer. But the problem is a bit different: I read an excel with Read range containing a column with double values (in excel these values are displayed with commas, as I work in Germany). When writing this datatable back to the csv file, these values are output with dots, which is not what I want in this place. Any idea?
Well, its like this. So the excel has double values. But it is shown in the format that has the comma in excel itself. However, the format which excel shows you does not actually apply when extracting data from excel to UiPath. Irrespective of the format excel shows, UiPath extracts the exact value which is in excel. So in your case, its the double value in normal format with the dot
So, in that case, within Uipath studio, you need to write a workflow to convert it to the format that you need which uses the comma. Then writing the result to excel will give you the exact output. So I have done a sample workflow for you. In my case, the reading excel has the normal number format, but writes back the same result with the comma. So basically it replaces the dot with the comma…
Check out the attached…
Let know whether this works for you…
if it works, please make sure to mark my answer as the solution too…
thank you for the solution, this obviously works. But I wonder if there should not be a more natural solution, e.g. a possibility, that the Write CSV activity exports data in the correct regional format defined for example by settings of os/computer/environment or explicitly defined in Project settings or (new) properties of the export activity (along the lines of Locale in Java).
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.