简体   繁体   English

如何将Excel数据导出到Mysql表

[英]How to export excel data into Mysql tables

How can we export Excel data into Mysql table . 我们如何将Excel数据导出到Mysql表中 Is there any plugIn in excel for converting data into mysql table or in any other methods? excel中是否有用于将数据转换为mysql表或任何其他方法的插件?

You can read and write by this. 您可以以此来读写 and also store data to your sqlite database table from .xls files cell. 并将数据从.xls文件单元存储到sqlite数据库表中。

You need to save your data in CSV format(comma separated values) format in a file then you can use LOAD DATA command to load the data from file to table 您需要将数据以CSV格式(逗号分隔的值)格式保存在文件中,然后可以使用LOAD DATA命令将数据从文件加载到表中

Example - 范例-

LOAD DATA INFILE 'path_of_file' INTO TABLE 'name_of_table' LOAD DATA INFILE'path_of_file'INTO TABLE'name_of_table'

more information on load data can be found in MySQL manuals available online 有关加载数据的更多信息,请参见在线提供的MySQL手册。

Convert your Excel to CSV first then import in phpmyadmin. 首先将您的Excel转换为CSV,然后导入phpmyadmin。 The number of columns in csv should be equal to number of columns in table, If you have auto increment for first column then leave first column of CSV blank. csv中的列数应等于表中的列数。如果第一列具有自动递增功能,则将CSV的第一列保留为空白。

在此处输入图片说明

IF you dont use phpmyadmin this or this will help you out with import. 如果您不使用phpmyadmin this将帮助您进行导入。

In case you convert Excel into CSV, then there is a way for bulk export: 如果将Excel转换为CSV,则有一种批量导出的方法:

query = "LOAD DATA INFILE '"+"\\FileName.csv"+"' INTO TABLE Table_Name  FIELDS TERMINATED BY ',' (Column_Name,....)";

Make sure, you match the table columns with the file(.csv) columns, to avoid error. 确保将表列与file(.csv)列匹配,以避免错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM