Home  >  Article  >  Database  >  How to import excel data into mysql?

How to import excel data into mysql?

青灯夜游
青灯夜游Original
2019-05-20 16:37:3715235browse

How to import excel data into mysql?

Mysql steps to import excel data:

1. In the first step, we got an excel table, which There is a lot of data that we need to import.

#2. Delete the first line of "Admission Ticket No." "XXX".... Only keep the data we need.

3. Click "File"--"Save As", select "CSV (comma separated) (*.csv)" as the type, and save the excel table as a csv document. No matter what prompts in the middle, just say "yes"...

Key point! The slyar.csv saved as can be opened with a text editor such as Notepad or Editplus. Let's open it and take a look.

You can see that the csv document is actually txt (that is, you can use your own txt and then change the suffix name), but separate the fields with "," Just separated. Since it is a txt document, it involves the issue of file encoding! The default saved file encoding is ANSI. If your database (data table) uses UTF-8 encoding, then be sure to save this csv file as UTF-8 format!

4. Enter phpMyAdmin to create a table, create a new field, and the field names are related to the fields of the excel table you want to import and in the same order. Too simple, no screenshots.

How to import excel data into mysql?

5. Open the table you created in phpMyAdmin and click "Import" at the top.

How to import excel data into mysql?

6, "Select "CSV using LOAD DATA" for "Import file format".

How to import excel data into mysql?

#7. "File to import" select the csv file you just saved as.

How to import excel data into mysql?

How to import excel data into mysql?

8, "Field separator" is changed to ",", which is the default selection of "(comma) in excel save Separated)", you can freely choose the separator, which usually occurs when there is "," in your excel table data.

How to import excel data into mysql?

10. "Field name" is an advanced application. The field name here is the field name in your data table. It indicates the field you want to fill. Multiple fields are separated by ",". Empty here means filling everything in order, and no extra data is needed.

11. If there is no problem, you can press "Execute".

12. "Import successful, 1 query executed." Seeing this means success

The above is the detailed content of How to import excel data into mysql?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn