Convert string to decimal and write it to Excel

Hi,

I am using below code to convert string to decimal and it is working as expected. But when i write values to Excel it is not writing it as decimal values

convert.ToDecimal(inputString) and also tried String.Format(β€œ{0:0.00}”,CDbl(inputString))

When i print the value i am getting the expected output but issues happens when it writes it to Excel.

Did anyone faced similar situation?

1 Like

@sathwik19

You have to change Column format in Excel file and then it will show decimal value.

how to automate it to change the column format from backend?

do you have any example

@sathwik19

I also faced same issue. I created one template Excel file with all columns of required type and then writing into that file. It’s solved my issue.

Okay thanks that might not work in my case i have to create a file daily and that should be seamless.

@sathwik19

No need to create file daily if the columns are same .