I generate an Excel file with importing a csv file. In CSV has contents with following numbers
4.0238484
5.3833888
dot seperated
But if I write an Excel file than the column show me the numbers in following format
4,0238484
5,3833888
I want the dot instead of comma.
How can I make it?
PHPExcel Version 1.7.7
Asked
Active
Viewed 2,961 times
0

Maco-ic
- 99
- 1
- 7
2 Answers
2
In PhpSpreadsheet (next generation of PhpExcel) you can avoid it's by this:
$sheet->setCellValueExplicitByColumnAndRow(__COL_INDEX__, __ROW_INDEX__, __SOME_DATA__, DataType::TYPE_STRING);
setCellValueExplicitByColumnAndRow can force turn your data into string

Wishmaster
- 1,102
- 14
- 20
0
Check the locale settings for the version of MS Excel that you are using to view the generated file: if it's set to a locale that uses a decimal comma rather than a decimal point, then this is what you will see. Floating point numbers in PHPExcel are managed with a decimal point (PHP doesn't offer any alternative for numbers), but MS Excel has its own formatting rules based on locale.

Mark Baker
- 209,507
- 32
- 346
- 385
-
How can I convert all cells in string? Text format? I think that will solve the problem. – Maco-ic May 12 '15 at 08:56
-
You shouldn't need to convert anything.... you say your CSV file contains a decimal point, so PHPExcel will load it correctly.... PHPExcel will save it correctly as xls. Why do you want to convert to stings? Simply set your MS Excel local settings to show a decimal point rather than a comma – Mark Baker May 12 '15 at 09:01