Ask the Expert

Converting an Excel file to MySQL

I have this query where I have to convert Excel files to MySQL databse files, and I have to write a script. Please help.

    Requires Free Membership to View

The easiest way to convert an Excel table to MySQL is to dump the table to CSV format, then use LOAD DATA INFILE to load it into a MySQL table. The syntax for loading a CSV file is as follows:

LOAD DATA INFILE 'data.csv' INTO TABLE tbl_name
          LINES TERMINATED BY '\n';
Full information on LOAD DATA INFILE can be found at

This was first published in March 2005

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: