How to display number like 2.98296e+007 in excel

Topics: Developer Forum
Sep 19, 2013 at 9:46 AM

I am querying mysql DB using php and writing the same to excel sheet.
But when i display numbers such as 2.98296e+007 i get a error in excel saying "The number in this cell is formatted as text or precedded by apostrophe".
I need to eliminate that error so that user can click on format cells and select number to display the number.

I tried the following, but the error is'nt going.

$objPHPExcel->getActiveSheet()->setCellValueExplicitByColumnAndRow($col, $row, trim($value),PHPExcel_Cell_DataType::TYPE_NUMERIC);

Request your help.
Sep 19, 2013 at 11:27 AM
Strange... a var_dump($value) show what ? If you use (float)$value, the returned number is correct ?