Merge datatable refused to convert format type from string to Number

Dear RPA expert,

I have several csv files which need to be merged and in which the column need to be written in currency format. The columns consists of various instance of numbers from 0,1.5 until 10.500,95.
To do this I do the following:

  1. Read csv and declare the output datatable as outDT
  2. I merge the data table and declare the output data table as mergedDT
  3. I add data column to duplicate the column which the format number i want to convert using ‘Add Data Column’ activity. Type of the argument is System.Double, name of the column is “Test 1”
  4. Then I assign the value of the new added column to be the value of the column I want to get rid off. say the one with the column name “Credit Limit”
  5. Then I write the excel using application scope

For this I got error message: 'Cannot convert value ‘30.006,00’ to Type: System.Double.
The strange thing is: If I only use one csv to convert the column, it did it like a charm.
Please help to inform whether there is something needs to be change or add in merge data table.
Thank you for your help, bros and sis!Capture1 Capture2 errorMessage

that Comma (,) is creating the problem. handle that comma before converting.

1 Like

You can handle the comma by using double.parse and give the correct culture-info (somewhere in the EU i’m assuming?)

1 Like

Hi @vikaskulhari, hi @Dave,

The comma is not the problem. As i told you before, single csv files is handled properly with the code.
I found the solution: one needs to use clone method prior to merge the datatable. It is because the empty datatable from merge datatable activity does not have not the same structure as the datatable from read csv output.

Thanks by the way for your time!

And also i have used the new culture info in the sequence to the europe one.

1 Like