Skip to content

another Excel Reader

Derek Jones edited this page Jul 5, 2012 · 10 revisions

Category:Library::External

While searching for an elegant solution of reading excel files with CodeIgniter I found this one here --> http://code.google.com/p/php-excel-reader/

There have been some severity depreciated php errors in the code. I've fixed them and adjusted the constructor to enable it, reading a params array passed by CodeIgniter's loader.

You can download it here: File:Spreadsheet_Excel_Reader.zip

1. Save the Spreadsheet_Excel_Reader.php from downloaded archive to ./system/application/libraries/

2. change error_reporting in your index.php to error_reporting(E_ALL ^ E_NOTICE);

3. Add this to you Controller

$pathToFile = 'anyPath'; $params = array('file' => $pathToFile, 'store_extended_info' => true,'outputEncoding' => '');

$this->load->library('Spreadsheet_Excel_Reader', $params); $data['xlsFile'] = $this->spreadsheet_excel_reader->dump(true, true); $this->load->view('yourView', $data);

4. and this to your View <?php echo $xlsFile; ?>

Clone this wiki locally