How to Import Excel to MySQL

Written by suqing wang
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Import Excel to MySQL
Import data between Excel and MySQL. (Jupiterimages/ Images)

You can import Excel data to MySQL using a few lines of commands. Excel is a part of the Microsoft Office suite. You can use Excel to contain and analyse data and charts via its formulas and functions. You can also import and export data to and from Excel spreadsheets. MySQL is an open-source database management system. You can freely download and install it from MySQL website (see Resources.) MySQL features flexibility, ease of use, high expandability and capability. It provides an integrated work space for developers and data administrators.

Skill level:
Moderately Challenging

Things you need

  • Excel
  • MySQL

Show MoreHide


  1. 1

    Double-click your Excel spreadsheet to open it. Click "File" and "Save As" to save your Excel data as a CSV file. Select "Other Formats" and enter a file name for the saved CSV file. Click "Save as Type," choose "Comma Delimiter (*.csv)" and click "Save" to save the file.

  2. 2

    Right-click the CSV file and choose a text editor such as Ntepad to edit it. Make sure the words are separated properly by delimiters. It should look like "a, b, c ."

  3. 3

    Click "Start" and "All Programs." Go to "MySQL Query Browser," "Tools" and "MySQL Command Line Client" to start the MySQL Command Prompt.

  4. 4

    Enter the following code:

    LOAD DATA LOCAL INFILE 'the path\yourfile.csv' INTO TABLE mysqldatabase.table FIELDS TERMINATED BY '' ENCLOSED BY "," 'LINES TERMINATED BY '\n' (field 1, field 2);.

    Execute the code. This will import your CSV file into mysqldatabase.table. The columns in CSV are separated by commas and the execution will be terminated by "Enter key" '\n.'

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.