如何将excel文件导入MySQL数据库 [英] How to import an excel file in to a MySQL database

查看:187
本文介绍了如何将excel文件导入MySQL数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



例如,我的Excel表格如下所示:

 国家|金额|数量
----------------------------------
美国| 93 | 0.60

希腊| 9377 | 0.80

澳大利亚| 9375 | 0.80

感谢提前。



Fero

解决方案


  1. 将其导出为一些文本格式。最简单的可能是制表符分隔的版本,但CSV也可以正常工作。


  2. 使用加载数据功能。请参阅 http://dev.mysql.com/doc/refman/ 5.1 / en / load-data.html


  3. 查看页面的一半,因为它将为标签分隔数据提供一个很好的例子:



    由'\t'终止的字段''ESCAPED BY'\'


  4. 检查你的数据。有时引用或转义有问题,您需要调整源代码,导入命令 - 或者可能通过SQL进行后处理更容易。



Can any one explain how to import a Microsoft Excel file in to a MySQL database?

For example, my Excel table looks like this:

Country   |   Amount   |   Qty
----------------------------------
America   |   93       |   0.60

Greece    |   9377     |   0.80

Australia |   9375     |   0.80

Thanks in Advance.

Fero

解决方案

  1. Export it into some text format. The easiest will probably be a tab-delimited version, but CSV can work as well.

  2. Use the load data capability. See http://dev.mysql.com/doc/refman/5.1/en/load-data.html

  3. Look half way down the page, as it will gives a good example for tab separated data:

    FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\'

  4. Check your data. Sometimes quoting or escaping has problems, and you need to adjust your source, import command-- or it may just be easier to post-process via SQL.

这篇关于如何将excel文件导入MySQL数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆