Skip to main content

Import CSV file into a MySQL database


Sometimes we might want to migrate our csv file/xlsx-file(s) into our database in order to work with them accordingly, php makes that possible.
With regards to this, I have written a simple script to make that easier base on a request from a good friend of mine and I thought it wise to share it with the world.
1. Firstly unzip the project file and paste it in your htdocs if you're using xampp or www folder if you are using wamp or your server folder if any.
2. Locate a readMe text file
3. Copy the sql code in the readMe text file and run it in your mysql work bench or phpmyadmin.
4. Open your web browser and run the index.php file
5. Voila!!, you have successfully imported a csv file.

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.


1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Add new comment

This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.