Q

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.

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
          FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
          LINES TERMINATED BY '\n';
Full information on LOAD DATA INFILE can be found at http://dev.mysql.com/doc/mysql/en/load-data.html.

This was last published in March 2005

Dig Deeper on Open source databases

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

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

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

SearchServerVirtualization

SearchCloudComputing

SearchEnterpriseDesktop

Close