getValue() cell format issue

Topics: Developer Forum, Project Management Forum, User Forum
Jan 27, 2012 at 12:34 PM

Hi,

Data in the Excel2007 is 

357646000201102 

but when I try to access the value i get this 3.576460002011E+14

What can i do for this?

 

Code:

$objPHPExcel->getActiveSheet()->getCell('A1')->getValue(); //returns 3.576460002011E+14

 


Jan 31, 2012 at 9:43 AM
Edited Jan 31, 2012 at 9:44 AM

Hi

Try this

http://phpexcel.codeplex.com/discussions/278582

cheers

Feb 1, 2012 at 1:56 PM

Thanks for your answer but this is for writing to excel, I have problem with reading from excel. Any advice?

Coordinator
Feb 1, 2012 at 8:51 PM

try using getFormattedValue() instead of getValue(). PHP has this tendency to use scientific notation for numbers above a certain size. getFormattedValue() will return the value as a string, formatted according to the cell format rules defined in Excel.

Alternatively, use PHP functions such as sprintf() to format the value as you need.

Feb 2, 2012 at 7:07 AM

Thank you very much  getFormattedValue() works for me:)