CodeIgniter Forums
Export to MS Excell, last digit turn into zero - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: General Help (https://forum.codeigniter.com/forum-24.html)
+--- Thread: Export to MS Excell, last digit turn into zero (/thread-75757.html)



Export to MS Excell, last digit turn into zero - kelapamuda - 03-13-2020

Hello 

Right now i already success in exporting my data from my CI website ( mine use mysql) into MS excell .
But if the data digit if bigger than 16, it digit turn into zero.
For example,,in mysql  my data is    12345678912345678,   but after i export it into MS EXcel it change to 12345678912345670.
I google and it says that ms excell change last digit into zero it if number if greater than 16 digit.
I already try to change datatype in mysql from varchar to tinytext, but the problem still happen.
How to solve it?
Thanks.


RE: Export to MS Excell, last digit turn into zero - zahhar - 03-13-2020

Cast value to text and enclose into `12345678912345678` characters.
Also depending on Excel version you may just add whitespace before the value, and enclose into single quotes: ' 12345678912345678'.


RE: Export to MS Excell, last digit turn into zero - kelapamuda - 03-22-2020

Yup,,in the export file, i change into this:
<td><?php echo ' &nbsp; '.$k->pengguna_username;?></td>
It works,,in Excell, it add space, and the number is not turn into zero at the end