Copy csv file to excel with decimal problem after decimal point

to copy a csv file to exel i use read csv and write it in a excel file, this part work well but when i check the result a have a difference on number.

in the csv file i have : 102,562 and after copy i have 102562

I don’t understand because i have no problem with 2 decimal only if the number have 3 decimal after decimal point
image

Hi ,

I hope comma is the decimal point here but in excel it is generally taken as number separators.

The below function can be used in the Excel to change number seperator and Decimal format
=NUMBERVALUE(Text,Decimal_separator,Group_separator)

1 Like

The datatable in which you read the CSV, make sure the column you are facing the issue in has string data type. The commas are getting affected because CSV uses comma as separators.

If the final Excel is a template, you can add the datatype on a column too, make it as a currency datatype

2 Likes

Hi Try this

Excel Scope Read Range, store in DataTable variable
    For each row In dt1
        Assign activity: row("YourColumnName") = "'"+If(IsNumeric(row("columnname").ToString), CDbl(row("columnname")).ToString("0.00"), "0.00")
    
    Write Range, use the DataTable variable and overwrite the excel file.

Hope this will work!!!

1 Like

Hi @ghazanfar
it doesn’t work for me

@Priyanka_Ramesh

Do you have a sample plz ? i dont really understand

@rahulsharma

I use semicolon in read csv
image

to copy a csv file to exel i use read csv and write it in a excel file, this part work well but when i check the result a have a difference on number.

in the csv file i have : 102,562 and after copy i have 102562
The good number is : 102,562

I don’t understand because i have no problem with 2 decimal only if the number have 3 decimal after decimal point
image

I can not see any “decimal point”, but comma. Does it mean that comma is decimal separator in your CSV?

Cheers

1 Like

@J0ska
yes the separator is ==> ;

This is the CSV separator, NOT decimal separator, right?

The value “102,562” should read “one hundred and two” or “one hundred and two thousands?”

Cheers

1 Like

@J0ska
in the csv file i have : 102,562 and after copy i have 102562
The good number is : 102,562

I can not help you if you do not answer to the question :frowning:
Bye

1 Like

sorry :slight_smile:
The value “102,562” should read “one hundred and two”

grafik

2 Likes

In that case your system - system locale - is set-up to interpret comma as thousands separator (not decimal separator) → before writing to Excel replace comma “,” by point “.”

And indeed check your system locale.

Cheers

1 Like

@ppr
so i need to use read column activity after copying the csv file in the excel file and replace it instead of 102,562 in your sentence right ?
Double.Parse(ColonneDecimal.ToString, System.Globalization.CultureInfo.CreateSpecificCulture(“fr-FR”)).ToString

@J0ska
i have any problem if the number have 2 decimal ==> example 120,05
but if the number is 120,503 it doesnt work

Hi @Soudios

Refer the thread

Regards
Gokul

1 Like

@Gokul001
it doesnt work