将 Excel 电子表格或 CVS 中的数据导入 MySQL

2021-11-20 00:00:00 mysql

我有一个电子表格,它实际上只有一个复杂的表格.我基本上将电子表格转换为 cvs 并使用 groovy 脚本生成 INSERT 脚本.

I have a spreadsheet which really has only one complicated table. I basically convert the spreadsheet to a cvs and use a groovy script to generate the INSERT scripts.

但是,我无法使用具有 28 个字段的表格来执行此操作,其中电子表格的某些字段中的数据会使导入 CVS 变得更加复杂.所以新的CVS中的字段没有正确区分或者我的脚本没有考虑到.

However, I cannot do this with a table that has 28 fields with data within some of the fields on the spreadsheet that make importing into the CVS even more complicated. So the fields in the new CVS are not differentiated properly or my script has not accounted for it.

有人对更好的方法有什么建议吗?谢谢.

Does anyone have any suggestions on a better approach to do this? Thanks.

推荐答案

看看 LOAD DATA INFILE 语句.它将帮助您将数据从 CSV 文件导入表格.

Have a look at LOAD DATA INFILE statement. It will help you to import data from the CSV file into table.

相关文章