Import Excel to MySQL Using PHP

This topic is entitled Import Excel to MySQL Using PHP, I believe that this source code will be a big help to everyone who wanted to Import the Excel/CSV file to MySQL Database.

In this project, I use twitter bootstrap framework for the themes and MySQL Database for storing the imported data from excel file. 

Screenshot of this project Import Excel to MySQL Using PHP

Import Excel to MySQL Using PHP
Import Excel to MySQL Using PHP

Steps how to run this project:

Step 1: Download the Full Source code here: excel source code 

Step 2: Extract the downloaded source code and put it in the Document root or in your htdocs folder

Step 3: Create a MySQL Database, Name it as studentdb“.

Step 4: Create a table, use the query below:

[sql]
CREATE TABLE `subject` (
`SUBJ_CODE` varchar(30) NOT NULL,
`SUBJ_DESCRIPTION` varchar(255) NOT NULL,
`UNIT` double NOT NULL,
`PRE_REQUISITE` varchar(30) NOT NULL DEFAULT ‘None’,
`COURSE_ID` int(11) NOT NULL,
`AY` varchar(30) NOT NULL,
`SEMESTER` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

[/sql]

Step 5: Run your project: copy this link to your browser. http://localhost/excel/index.php

Note:

In order for you to import the excel file, make sure that the format of excel file is set to CSV.

You can use the sample csv file located in your main document folder.

Please see the image below for your reference. The file is “subject.csv”.

Import Excel to MySQL Using PHP sample CSV file
Import Excel to MySQL Using PHP sample CSV file

If you have any questions or suggestion about Import Excel to MySQL Using PHP, please feel free to contact me at our contact page.

Next Topic: Exporting Record from MySQL database to Excel file Using PHP.

Import Excel to MySQL Using PHP Related Topic:

If you find this article useful, please a comment below and share this with your friends who loves to do programming.

Leave a Comment