Two ways to import Excel data into MySQL database

Source: Internet
Author: User
Tags mysql tutorial phpmyadmin

Here we want to talk about two kinds of Excel data into the MySQL Tutorial database tutorial methods, these two methods are relatively simple, is also very convenient, before I put the Excel data into the MySQL database is a PHP tutorial program to instance, now we do not need a program, with existing tools on the line.

Method one, using phpMyAdmin to import Excel data into MySQL database method is as follows

This is Excel and must be the way it is.

The format of the phpMyAdmin import file should be configured as shown above. (Note that the structure of the imported Excel table must be the same as the structure of the MySQL datasheet, the data type, etc.) OK. Otherwise, the failed import will be imported.

Method Two, the Excel file is generated. sql file OK

1. In the last column of data that you want to import, write an Excel formula, as follows
=concatenate ("INSERT into employee (name,birthday,email,hobby) VALUES ('", rc[-4], "', '", rc[-3], "', ', rc[-2]," ', ' ", RC [-1], "');"
2. Select the last column, copy the data to a text file, and save the text file as a. sql file (don't forget to delete the first row of "SQL").
Note: If there is a date, modify the formula
=concatenate ("INSERT into employee (name,birthday,email,hobby) VALUES ('", rc[-4], "', '", Text (rc[-3), "Yyyy-mm-dd hh:mm : ss ")," ', ', ' ", rc[-2]," ', ' ", rc[-1]," ');

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.