在mysql数据库中导入excel数据 [英] Importing excel data in mysql database
问题描述
快速肮脏:
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屋!