WPS办公软件 icon WPS办公软件

电子表格

在 WPS 电子表格中打开和保存 CSV,无需 mojibake

CSV 是一个伪装成电子表格的文本转储。编码和区域设置是游戏的全部。如果弄错了,“José”就会变成“José”,1.5 就会变成五月一日。

开幕

  1. 如果可以的话,请勿双击 CSV。在电子表格中:数据 → 从文本/打开,然后选择 UTF-8。双击使用操作系统默认编码,在许多 Windows 区域设置中该编码仍然不是 UTF-8。
  2. 确认分隔符:逗号、分号或制表符。欧洲出口经常使用分号,因为逗号是小数点。如果每一行都位于 A 列,则说明您选择了错误的分隔符。
  3. 预览列类型。 IBAN 和电话号码必须是文本,否则您会丢失前导零。日期:选择与文件匹配的格式,而不是您想要的格式。

节省

另存为 CSV UTF-8 if the other system is any modern web app. If a 1998 ERP wants ANSI/Windows-1252, you will have to speak its dialect — and you should document that in the filename: invoices-1252.csv. 电子表格 will warn that it drops sheets, formulas, and formatting. Believe the warning. Keep the XLSX as the brain, CSV as the mouth.

另一端的 Excel 陷阱

您发送 UTF-8 CSV。他们通过双击在 Excel 中打开它。 Excel 在某些地区采用本地 ANSI。他们打电话给您并说文件已损坏。告诉他们数据 → 从文本 → UTF-8,或发送 XLSX。这不是 WPS 错误。

物料清单

A UTF-8 物料清单 (the invisible first bytes) helps old Excel guess UTF-8 and hurts some Linux tools. If a script complains about Name in the header, you have a 物料清单. Re-export without it, or skip one character in the parser. Neither option is “wrong”; they are incompatible cultures.

字段内的换行符

如果有人在不带引号的情况下保存,则在单元格中输入 Enter 的注释列将拆分行。在电子表格中重新打开,检查行数与已知良好的行数,修复单元格,再次导出。切勿在记事本中修复 40,000 行转储。

More: 电子表格 · formulas.

一个文件,多个表

A dump with a blank row then a second header is two CSVs wearing a trench coat. Split before import, or you will teach 电子表格 that “Total” is a payee. If the bank adds a 3-line letterhead, skip those rows in the import wizard every month until you automate — and when you automate, assert the header equals Date,Description,Amount or abort.

往返测试

保存 UTF-8 CSV,关闭,然后使用向导重新打开。行数必须匹配。抽查 José、负数和带逗号的长描述。如果逗号分割字段,引号就会被删除 - 再次从 XLSX 导出,不要手动编辑 4,000 行。