CSV FILE CONVERTING BIG INTERGER AS EXCEL DEFAULT VALUE LIKE 4.04623E+12

Topics: Developer Forum, Project Management Forum, User Forum
Jan 17, 2014 at 1:53 PM
Hi,
I have a big interger 4046228043128. I want this number as it is when it writes into csv file. But when i write into csv file that number converts into 4.04623E+12 format. But when i try to write in .xls / .xlsx file that number is displaying as it is. Below is the code i am using .
$objPHPExcel2->getActiveSheet()->getStyle('D'.$s)->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_TEXT);
$objPHPExcel2->getActiveSheet()->setCellValueExplicit('D'.$s, $csvrow['EXTERNAL_ID']);

For .xls i am using the below code
->setCellValueExplicit('D'.$s, $csvrow['EXTERNAL_ID'],PHPExcel_Cell_DataType::TYPE_STRING)
this one works fine for me .But when file type is csv i am getting the problem.

Please help me in this regard.

Thanks in advance.
Jan 22, 2014 at 1:35 PM
If I created a CSV file containing your sample number and that I open this result with the Notepad, I found the intact number, on the other hand, if I open this file with Excel, the latter transforms the number in scientific notation.
The value is enclosed in quotation marks, hard to beat next to the format, but Excel book interpretation.
Jan 30, 2014 at 8:32 AM
Yes, I confirm this is a common and weel--and-sadly-known issue of all excel versions. If it import a csv with large numbers it try to apply scientific notation.

You must do implicit import of csv into excel setting up the column type. Sorry.

And this is of course not a PHPExcel issue.