Keep decimal places at 2 decimals

Hi everyone,

I’m having an excel with string variables in one column (column1) with values that are like this: 7.60
When i’m opening this in a datatable via excel application scope, i’m getting 7.6 as value.
But i want to keep it as 7.60. Is there a code that i can keep my 2 decimal places in my datatable on uipath?

2 Likes

Hi @hansgeeroms

String.Format("{0:0.00}", row(Columnname))

This would work @hansgeeroms

8 Likes

While you retrieve data back from the data table, you can use the following sample codes.

String.Format("F2", dtTable.Columns("ColumnName"))
String.Format("0.00", dtTable.Columns("ColumnName"))
String.Format("0.##", dtTable.Columns("ColumnName"))

Thanks! This works in my for each row activity!!!

1 Like

Cheers buddy keep going @hansgeeroms

1 Like

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