尝试使用解决方案将 csv 从电子表格加载到 MySQL Workbench found here
LOAD DATA LOCAL INFILE '/path/to/your/csv/file/model.csv' INTO TABLE test.dummy FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n';
数据已加载,但电子表格中的某些单元格已包含换行符。在这些情况下,LOAD 创建了一条新记录。
Mathematics Kindergarten,Counting,"Say the number sequence 0 to 1000 forward and backward by:
- 5s, 10s or 100s, using any starting point
- 3s, using starting points that are multiples of 3
- 4s, using starting points that are multiples of 4
- 25s, using starting points that are multiples of 25."
使用类似以下格式的表格:
Course | Topic | Description
数据加载如下:
Mathematics Kindergarten | Counting | "Say the number sequence 0 to 1000 forward and backward by:
- 5s, 10s or 100s, using any starting point | |
- 3s, using starting points that are multiples of 3 | |
- 4s, using starting points that are multiples of 4 | |
- 25s, using starting points that are multiples of 25." | |
如何让系统识别加载数据,以便整个单元格包含完整的描述,并且不会因 X 条记录而中断。
最佳答案
这些步骤让我返回到导出 CSV 的文档。我必须清理数据。
查找单元格中存在的回车
和换行
字符并将其替换为\n
。
还发现其他一些单元格在 html 编号 ,
,
这纠正了 MySQL Workbench 数据导入工具的问题。
关于php - 将 CSV 导入 MySQL Workbench,其中文本字段包含数据换行符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43147569/