String To integer1

Hey I have one row which have no as string I want all no as integer format Like(0.00)
Can we have any code or any solution for this

Hi @Kuldeep_Pandey

Use Convert.ToDouble method
If you want the format “0.00” then use
outputString = Convert.ToDouble(inputString).ToString(“0.00”)

Hi @Kuldeep_Pandey

Try this

Int=Cdbl(String)

@Kuldeep_Pandey

For Each Row in dt_ProcessName
{
Assign - row(“ColumnName”) = String.Format(“{0:0.00}”, Convert.ToDouble(row(“ColumnName”).ToString()))
}


Giving error like this

Hi @Kuldeep_Pandey

Can you try with the following expression

Convert.ToDecimal("52525").ToString(“0.00”)

image

Can you share the sample input?

Regards
Gokul

Hi @Kuldeep_Pandey ,
Can you share your file?
strOutput = Convert.ToDouble(strInput).ToString(“0.00”)
Regards,

image
Sample Input I want to change quantity format as integer

Test.xlsx (11.0 KB)
Please find the input file
I want to change quantity type

Hi @Kuldeep_Pandey,
Whenever you’ll try to write the data back to excel as 0.00 it’ll revert back to 0 or 14.00 to 14

If you need it to look like with decimal points.

Use Excel activities: Format Cells and set format as Number with 2 Decimals.

That would do what’s needed.

Also provide the range.

Happy Automation!

Use if activity to manuplate the alpabet in the quantity column

Condition -> Not System.Text.RegularExpressions.Regex.IsMatch(".112","[A-Za-z]+")

Then - > Use Assign activity

Convert.ToDecimal("52525").ToString(“0.00”)

image

Regards
Gokul

We dont have any alphabet in quantity column

Then what is this from the Screenshot

image

Regards
Gokul

I don’t Know the range
Can we add column name?

Try with B:B, that should work

If you don’t know the range. You can maybe use
“B3:B”+(DT.Rowcount+3).tostring

Hi Kuldeep_Pandey

First, the Sheet1 tab from the test.xlsx file is read into the DataTable dt variable, then the values ​​from the Quantity column will be converted one by one, to the Double type. In the example in the figure, I rewrote the dt variable in test.xlsx in the Sheet2 tab. The conversion is done starting from line 3 upwards with:
Assign: item(“Quantity”) = if(i>0,CDbl(item(“Quantity”)),item(“Quantity”))