CodeIgniter Forums
write and read excel files with codeigniter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: write and read excel files with codeigniter (/thread-41098.html)



write and read excel files with codeigniter - El Forum - 04-28-2011

[eluser]Sudz[/eluser]
Can anybody help me,

Is there any library or helper to write and read excel file in codeigniter?


write and read excel files with codeigniter - El Forum - 04-28-2011

[eluser]louisl[/eluser]
You can use html tables as Excel documents.


write and read excel files with codeigniter - El Forum - 04-28-2011

[eluser]michalsn[/eluser]
[quote author="Sudhakar Prajapati" date="1303994788"]Is there any library or helper to write and read excel file in codeigniter?[/quote] No, but you can use PHPExcel http://phpexcel.codeplex.com/
CI wiki: http://codeigniter.com/wiki/PHPExcel/ and some tutorial: http://virusandlinux.baskoroadi.web.id/index.php/2008/11/tutorial-write-and-read-excel-files-with-codeigniter/


write and read excel files with codeigniter - El Forum - 06-01-2011

[eluser]Seb[/eluser]
The user guide given on the previous post is a little bit deprecated for the current CI.

You can follow the directives at http://codeigniter.com/wiki/PHPExcel/ and then for example to generate XLSX on the fly :

Code:
$this->load->library('PHPExcel');
$this->load->library('PHPExcel/IOFactory');

$objPHPExcel = new PHPExcel();
$objPHPExcel->setActiveSheetIndex(0);
$objPHPExcel->getActiveSheet()->SetCellValue('A1', 'Hello');
$objPHPExcel->getActiveSheet()->SetCellValue('B2', 'world!');

$objWriter = IOFactory::createWriter($objPHPExcel, 'Excel2007');

header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="Filename.xlsx"');
header('Cache-Control: max-age=0');
$objWriter->save('php://output');