Different values after importing for the same data in CVS and XLS formats

Topics: User Forum
Sep 4, 2013 at 10:13 AM
Good day.
Apologize if below topic already been discussed.

For now I'm not able to understand why when I load below data in CSV file format:

After importing [ $value = (int) $cell->getValue(); ] I receiving:

But when the same data loaded in XLSX format values imported as needed.
If I removing (int) near getValue nothing changes for XLSX format, but for CSV values appeared as follows:

Any ideas how that issue could be fixed?
Sep 5, 2013 at 12:25 PM
I think you need to write a value binder, "mixing" the default value binder and the method used by the Excel 2007 Reader.
Actually, the default value binder (used in CSV) cast to float any number, the Excel loader is more smart, he check if php can store the value as an integer, else cast to float (but i don't know why it try "double", afaik, in php, it's the same as float).
You can also check the "precision" setting in php.ini, the default 14 seems small for you. Be careful if you need some calculation, with your numbers, you can easily going after max integer and having an automatic cast.

(You use php in 64b, i guess ?)
If you build Excel files with these numbers, at least on 32b Excel, the values will be rounded (your first value is accepted by Excel, but the formula area show 8937201013040380000 and the cell display 8.9372E+18)