Using Excel file you can store all the data and import the Excel file data into the database at once using MYSQL and Codeigniter.Import Excel into MySQL helps to save the user time and avoid repetitive work.In this tutorial, We will explain how to import an Excel into MySQL database 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
Syntax:
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 Import_model.php inside “application/models” folder.

Step 6: Create views (Upload Excel file)
Create a views file named index.php inside “application/views/import” folder.

Step 7: Create views (Display Excel data)
Create a views file named display.php inside “application/views/import” folder.

Demo   Download

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="">