13 digit numbers get rounded in Excel 5 format

Topics: Developer Forum
Jul 31, 2013 at 2:01 PM
hello guys, i'm using phpexcel to read an excel file. on the first column i have 13 digit numbers to represent codebars, but when using this library i get something like this:

original value in excel: 7798114550247
phpexcel returned value: 7798114550250

i think there's an issue in the calculation PHPExcel\Reader\Excel5.php in the function _readNumber()
Jul 31, 2013 at 2:27 PM
32-bit or 64-bit versions? Is this really an integer number, or a float or is it a string?

That value exceeds the limits of 32-bit Excel for integers, so it should be maintained as a string in the xls file if maintaining precision is needed, so _readNumber() should never be called.

Can you please provide an example file that demonstrates this problem, together with the script that you are using to test it.
Jul 31, 2013 at 6:28 PM
i'm using a 64 bits version of windows 7 with php 5.3.

the column is in "general" format, is there a way phpexcel can handle this values?

i tried using an import programe made in fox and used the exact same file and the result is okay, so obviously there's a difference on how phpexcel and fox import excel files. is tehre a way to replicate this behaviour?

the excel file i'm using is this


by the way i also used this library to generate excel files and it works wornderfull
Aug 2, 2013 at 8:04 PM
any luck on this?
Aug 2, 2013 at 10:26 PM
Edited Aug 2, 2013 at 10:27 PM
Unless you have a 64-bit version of PHP, it can't handle 64-bit integer values, so PHPExcel can't either: if you're running 64-bit PHP, then it shouldn't be an issue
Aug 5, 2013 at 8:16 PM
is there a way we can tell phpexcel to force read as string even when the excel value is integer?
Aug 5, 2013 at 9:25 PM
There is, by rewriting the readers and cell core but doing so will seriously affect the cell formatting functions, destroying the functionality of the calculation engine, and causing major problems for the writers.