我可以将excel文件导入phpmyadmin吗?
我有一个电子表格文件,其中包含一些数据,例如 ID、姓名、姓氏。我可以将 Excel 文件导入 phpmyadmin (SQL) 吗? 怎么做呢?
I have an speadsheet file contains some data such as ID, name, lastname. Can I import excel file to phpmyadmin (SQL)?
How to do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
首先将电子表格导出为 CSV,然后导入为 CSV。
Export the spreadsheet as CSV first, then import as CSV.
Excel 表格不得包含空白单元格 - 当创建 CSV 文件时,行中字段数错误时,这些单元格将被跳过担心的。此外,Excel 单元格不得包含任何用作分隔符的符号(通常为双引号
"
和逗号,
。分隔符可能会根据 Excel 版本/语言的不同而有所不同Excel2016 CSV 看起来像:
...但是 phpMyAdmin 要求:
我的提示 - 在 Excel 表格之前和之后添加额外的列并填充每个列包含诸如
ZZ
之类的独特内容的列,然后使用带有查找/替换的文本编辑器将每个逗号更改为", "
。这将为您提供ZZ","22","Fred","Bloggs","22","Acacia Avenue","ZZ
。然后查找/替换ZZ","
与"
,然后","ZZ
与 "现在是您的 CSV 。符合 phpMyAdmin 的需要。
Excel tables must not have blank cells - these will be skipped when CSV file is created giving the wrong number of fields in the row(s) concerned. Also Excel cells must not contain any symbols used as delimiters (typically doublequote
"
and comma,
. The delimiters may vary according to excel version/language.Excel 2016 CSV looks like:
...but phpMyAdmin requires:
My tip - add extra columns before and after your excel table and fill each column with something unique like
ZZ
. Then create CSV. Use a text editor with Find/Replace to change each comma to","
. This gives youZZ","22","Fred","Bloggs","22","Acacia Avenue","ZZ
. Then Find/ReplaceZZ","
with"
and then","ZZ
with ".Now your CSV matches what phpMyAdmin needs.
您认为可能是空的 Excel 字段中是否有空格?您还想检查文本字段中是否未显示分隔符。这意味着,如果您用逗号存储了一个人的姓名或 ID,例如“Nixon,Richard”,它会认为这是两个单独的列,从而使您在使用第一个删除行作为超过 2 列时出现计数不匹配。
该错误消息告诉您,与数据行相比,它发现了不同数量的列。您的分隔符很可能位于数据单元内部。
is there a white space in what you think could be an empty excel field? Also you want to check that your delimiter isnt represented in the text field. Meaning that if you have stored a persons name or id with a comma, like "Nixon, Richard", it will think that is for two seperate colums, giving you a count mismatch on using the first delemited lines as more than 2 colums.
The error message is telling you that it found a different number of columns when compared to the rows of data. More than likely your delimiter is inside of your datacells.