Change dt format

I have a column named “Price” from data scraping. By default it is of string datatype. I want to change it to double.

@tara017

Try this: cdbl(yourString)

Do I have to assign this to a variable?

@tara017

Yes.

In Assign, doublePrice = cdbl(stringPrice)

stringtodouble

@tara017 Change data type to generic and check.

@tara017

Could you please share your workflow file with me and will check and update you.

Hi @tara017

Looks like your string has set of spaces in the front… see the error message closely.

Try this
doublePrice = cdbl(stringPrice.Trim)

Yes, there are spaces in the front. Same error is showing up. In Excel, just hitting backspace till all the spaces are gone & hitting enter saves the price in a numeric format. Is there a way to do that in UiPath? Or is there a way to change datatype of the column from data scraping before writing it to excel?

Hi @tara017

yes you can do that in UiPath. Refer my above comment,

By using this command, you can easily remove the leading spaces without the need of backspace key. Once this is done, write the value back to the excel. It will work without a problem

As a good practice i always try to follow below code.
cdbl

1 Like