Convert datacolumns from string to decimal

Hi guys,

I’m new to UIpath and I stumbled across a problem I’m unable to solve. I have a datatable with string values (obtained through data scraping), of which I want to convert some to decimal values (see example below). Convert.ToDecimal() doesn’t seem to apply on datatables (or datacolumns).

ex. change:s

col1 col2 col3
“10.12” “name1” “9.64”
“14.31” “name2” “2.40”

col1 col2 col3
10.12 “name1” 9.64
14.31 “name2” 2.40

Any advice on how I could achieve this? Many thanks in advance!

Best, Mark

Hi @markone,

Have you tried Convert.ToDouble(“your value”)


Hi @PD2,

Thanks to your help, I managed to figure it out! Turns out my row-iteration was wrong, after fixing that the ‘normal’ Convert.ToDecimal worked out perfectly in an assign activity.


  1. Use a for each row activity to iterate over cell values (within the datatable)
  2. Use an assign activity to perform the following operation:
    a. row.Item(“col1”) = Convert.ToDecimal(row.Item(“Col1”))

It should look something like this:
*where DT is the example datatable

NB: while performing this operation on currency data, it failed on strange symbols (€), so I used @MAHESH1’s solution to keep only numerical values from a string:

string b= System.Text.RegularExpressions.Regex.Replace(“string_Variable”,"\D","")

Once again, thanks for all the help!

Kind regards, Mark

Hi @markone,

I’m glad you got it fixed. Also thanks for sharing the solution, it will help someone on the community.

Happy Automating!


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.