通过phpmyadmin在Mysql中加载CSV数据
我有一个像这样的 Excel 文件:
a
1 word1 : mean1
2 word2 : mean2
3 word3 : mean3
.
.
我已将其保存为 cvs 文件。我可以将这个cvs文件与这个表一起导入到mysql吗?
id word mean
1 word1 mean1
2 word2 mean2
我尝试过使用 LOAD DATA 的 CSV 和以 : 结尾的字段,并且仅导入 ids。 提前致谢
I have a excel file like this:
a
1 word1 : mean1
2 word2 : mean2
3 word3 : mean3
.
.
and I have saved this a cvs file. Can I import this cvs file to mysql with this table?
id word mean
1 word1 mean1
2 word2 mean2
I have tried CSV using LOAD DATA
with Fields terminated by :
and only ids imported.
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
制作 Excel 文件的副本。在副本中:
电子表格看起来像您的表格
想要在 MySQL 中。
将副本导出为 CSV。
在 phpMyAdmin 中创建数据库。
在 phpMyAdmin 的导入页面上使用这些设置。
在导入的文件格式部分中,选择 CSV。
在选项部分中,设置以下内容:
是一个以逗号分隔的 CSV 文件
值)
在要导入的文件部分中,浏览查找将文件保存到您的计算机上,无论您将其保存在何处,
请单击前往按钮。
Make a copy of your Excel file. In the copy:
spreadsheet looks like the table you
want in MySQL.
Export the copy to CSV.
Create a database in phpMyAdmin.
Use these settings on the Import page of phpMyAdmin.
In the Format of imported file section, select CSV.
In the Options section, set the following:
is a CSV file with comma separated
values)
In the File to import section, browse for the file on your computer, wherever you saved it.
Click the Go button.
最好的选择是一个简短的 PHP 脚本,如下所示:
Your best bet is a short PHP script, something like this:
使用 phpmyadmin
选择导出为
Excel 2007 XLSX Workbook
选中“另存为文件”复选框
。就这样。
use phpmyadmin
choose export as
Excel 2007 XLSX Workbook
check the checkbox saying
Save as file. Thats all.