Using PHPExcel with Codeigniter

Using PHPExcel with Codeigniter

PHPExcel Library is bunch of PHP classes (library) to read a write the all the type of excel extension files like .XLS , .XLSX etc . Using PHPExcel with codeigniter we need to make some necessary modification in PHPExcel.By following few steps you will no need to make any edits in PHPExcel source code and usage is very easy and convenient just like you use “plain-startigt” PHP coding.

Using PHPExcel with Codeigniter


Download the most recent version of codeigniter from below link
Download Codeigniter most recent version


Download PHPExcel libarry from it’s github repository or you can download it from PHPExcel official website.
Dwonload PHPExcel library
Dwonload PHPExcel library from GIThub repository from


Extract both codeigniter and PHPExcel libraray archive(.zip , .tar) Place the PHPExcel directorty inside “your-project-directory/application/third_party/” directory . Your “your-project-directory/application/third_party” directory look like as below.


Create a new php file inside codeigniter “your-project-directory/application/libraries” and name the file Excel.php and place the below code inside the Excel.php file.

Now you can use the PHPExcel library inside your any codeigniter controller.


Now we are going to import Excel file with PHPExcel inside codeigniter.

It will return all excel data in $allDataInSheet with associative array.Apply for each loop on $allDataInSheet to get data as below

Read Other Interesting Articles

Codeigniter Interesting Articles

PDO Library Informative Articles