Read data from Excel and store in MySQL database using PHP

This is continuation of my previous video https://www.youtube.com/watch?v=LWXEsVFbED4.

In this video I have shown how you can import data from excel file and insert into a table in MySQL database.
This example shown in XAMPP server in windows 10 PC.

1. Create Table in MySQL Database.
First create the table using the below create table query in MySQL. You can create any table according to your need.
My excel file has columns with employee_id,department,user_category,nationality,gender.

2. Download the PHP excel library and keep it in the root folder or anywhere accessible by the reading page.
Kindly download the library Classes here.

3. Create connection with the database using below code. Please update the code as per you connection information.

4. Now with the index.php code below. You can read the file test1.xlsx. After running the code in server the screenshot is shown below.

The test1.xlsx is shown below.

After running the index.php in server, The page is shown below.
Once this is run all the data will be saved in MySQL database.

5. Download the complete project here read_from_excel_and_save_in_mysql_database