In this post, we will explain how to Export data into Excel in CodeIgniter. Export data functionality makes your web application user-friendly and helps the user to maintain list data. Excel is the best technique to Export data in a file and you can easily export data to Excel using Codeigniter.

First, we need to download PHPExcel Library, then extract PHPExcel Library
Step 1: Extract PHPExcel Library
Note: Copy and Paste inside “application/third_party” folder.

Step 2: Create file
Create a file named Excel.php inside “application/libraries” folder.

Step 3: Create Database
For this tutorial, you need a MySQL database with the following table:

Step 4: Create Controller and load class
Load “excel” class in controller.

Create a controller file like contactus.php inside “application/controllers” folder.

Step 5: Create Model
Create a model file named Export_model.php inside “application/models” folder.

Step 6: Create views
Create a views file named index.php inside “application/views/export” folder.


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">