Alex Hu
Alex Hu

Reputation: 107

How do I import Excel data into a MySQL table?

I have a table mileage_registrants which keeps users registration data. It has a field department which is NULL for all users now. I want to insert department data from a .xlsx file into table department. There are one thousand records so it is horrible for me to insert them by hand.

Is there anyway for me to get this done quickly?

Upvotes: 2

Views: 3185

Answers (2)

fatnjazzy
fatnjazzy

Reputation: 6152

you can do it via excel itselfe.
Here you can find a quick tutorials of you to interact with excel from mysql

http://www.heritage-tech.net/908/inserting-data-into-mysql-from-excel-using-vba/
http://www.heritage-tech.net/267/interfacing-with-mysql-via-excel/
http://blog.tjitjing.com/index.php/2008/02/import-excel-data-into-mysql-in-5-easy.html

It is highly recommended to do a dry run before running on production

Upvotes: 1

Laurent'
Laurent'

Reputation: 2631

Assuming you have access to PhpMyAdmin, you may want to export your xlsx to CSV format, then import it using PhpMyAdmin import tool.

Beware of the encoding though!

Upvotes: 2

Related Questions