在mysql数据库中导入excel数据 [英] Importing excel data in mysql database

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

问题描述

我有一个excel文件,大约5000行被插入到我的一个mysql数据库表中,任何人都可以提供快速而肮脏的解决方案?谢谢

解决方案

快速肮脏:



Excel生成一个insert语句。然后COPY + PASTE所有句子到MySQL命令解释器。



您的单元格应该有如下公式:

  = CONCATENATE(insert into your table(col1,col2)values(,A1,,,B1);)

然后复制所有行上的公式,您将有脚本。



其他快速&脏:



使用ACCESS打开Excel文件,然后使用导出到ODBC功能将您的数据放入MySQL。这是一个更复杂一点,因为你必须设置你的ODBC驱动程序和连接,但如果你打算这样定期,这可能是一个更好的选择。


I have a excel file with about 5000 rows to be insersted at one of my mysql databse table, can anyone give quick and dirty solution ? Thanks

解决方案

Quick and dirty:

Put a calculated column in Excel to generate a "insert" statement. Then COPY+PASTE all sentences into MySQL command interpreter.

Your cell should have a formula like this:

=CONCATENATE("insert into your table (col1, col2) values (", A1, ", ", B1, ");")

Then copy the formula on all the rows and you'll have your script.

Other quick & dirty:

Open your Excel file with ACCESS, then use "Export to ODBC" function to put your data in MySQL. It's a little bit more complicated since you will have to setup your ODBC driver and Connection but if you plan to do this regularly, it might be a better choice.

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

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