0

I have been trying to import this excel file my mysql database, and it has been rough. There are around 7,000 rows in the .xls file, but when I export it to .csv and parse it with PHP I get one of two issues:

  • Excel does not escape anything, ie. the commas in each row split the data
  • When I change all commas to * then export for some reason excel changes a whole bunch of lines to a bunch of pound signs #####.

(Is there a reason it does this?)

I can upload the .xls somewhere if need be.

4

2 回答 2

0

作为建议,如果您正在处理确实包含广泛使用的逗号的单元格,一个简单的解决方案是以制表符分隔格式 (TXT) 从 Excel 导出,或者单独包含您通常不会使用的字符的任何格式遇到。

我发现它是一种非常简单的方法,可以解决与从 Excel 导出和导入数据库介质相关的许多问题。

于 2010-01-18T21:45:42.560 回答
0

弄清楚了!

原来这是Excel的错。我在 Excel 中打开它之前检查了 .xls,而不是###。但在将其保存在 Excel 中后,它们出现了。

所以我在 Numbers(iWork 的一部分)中打开它,将所有 , 更改为 *,并将所有引号更改为 %(这些从未出现在任何行中。将其导出为 .csv,然后在使用 PHP 导入时将其更改回来。

工作得很好。:-)

于 2010-01-18T23:44:03.520 回答