I have attached the xlsx file. in D column I have amount data which is string. I would like to make all the data upto two decimal.
I have applied - String.Format(“{0:0.00}”, row(“Amount”).ToString) but it is not working. as it is a string column I could not able to use convert.todouble also.
Please share your feed back with me how I going to make it two decimal value for each row of amount column. data.xlsx (9.0 KB)
Try this:
=> Use Read Range Workbook to read the excel and store the outpu in datatable say dt_data
=> Use For Each Row in DataTable to iterate through dt_data
=> Use below syntax in Assign acitivty.
Read Range: Use the Read Range activity to read the data into a DataTable variable.
For Each Row in DataTable: Iterate through each row of the DataTable.
Assign Activity Inside the Loop:
If Double.TryParse(row(“Amount”).ToString, tempAmount)
Then
row(“Amount”) = tempAmount.ToString(“F2”)
Else
’ Handle the case where the conversion fails, perhaps set to “0.00” or leave as is
row(“Amount”) = “0.00”