Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

phpExcel write long number in cell

While writing the excel file is fine I see that really long numbers are formulas in excel

Example: 8.71129E+12

instead of: 1234567890

How can I change the format during the PHP Excel Creation?

I'm following the simple example here

like image 829
Phill Pafford Avatar asked Feb 18 '11 20:02

Phill Pafford


2 Answers

$objPHPExcel->getActiveSheet()->setCellValueExplicit('A1', '1234567890', PHPExcel_Cell_DataType::TYPE_STRING);
like image 68
Sarwar Erfan Avatar answered Oct 12 '22 05:10

Sarwar Erfan


Either set the value explicitly as a string, or set a number format mask for the cell that forces display of all digits (e.g. '#,##0' 0r '0') rather than default format.

like image 27
Mark Baker Avatar answered Oct 12 '22 05:10

Mark Baker