Jess Moi
Jess Moi

Reputation: 49

CodeIgniter PHPExcel export to excel for 16 digit varchar data type error

I am trying to export a table from MySQL to excel in Codeigniter using PHPExcel. But for a column with varchar datatype [16 digits], the result in excel become something like a,bE+15. For example for 3374142005140004 in MySQL, in excel from the export it became 3,37414E+15 or 3374142005140000, so I lost the last digit value which is 4. The best file type to export to is OpenDocumentSpreadsheet (.ODS) [Tried it manually from xampp export file]. But PHPExcel doesn't have OOCalc writer yet. And I don't know how to integrate PHPMYADMIN export in CodeIgniter app. So, If anyone have the solution for this problem, please please share the solution. Thanks in advance for any help/suggestion.

Upvotes: 0

Views: 710

Answers (1)

Mark Baker
Mark Baker

Reputation: 212412

If your string value is longer than a PHP integer, then you'll need to save it as a string using setCellValueExplicit() instead of setCellValue()

PHPExcel does allow you to write OpenOfficeXML files using the OpenDocument Writer

Upvotes: 1

Related Questions