CSV 文件是什么(一句话)What a CSV File Is (in one line)
CSV 是用逗号分隔值的纯文本表格:第一行通常是表头,之后每行是一条记录。它不带格式、体积小、任何程序都能读。入门可看 什么是 CSV 文件。
CSV is comma-separated plain text: the first line is usually a header, each later line a record. No formatting, small, readable by anything. See What Is a CSV File to start.
方法一:用记事本 / 文本编辑器Method 1: Notepad / Text Editor
- 新建文本文件,第一行写表头,例如
姓名,城市,邮箱。 - 每行填一条数据,用逗号分隔:
张三,北京,zhang@example.com。 - "另存为",文件名
data.csv,编码选 UTF-8。
- New text file; line 1 is the header, e.g.
name,city,email. - Each line is one record, comma-separated:
Zhang San,Beijing,zhang@example.com. - "Save as" with name
data.csv, encoding UTF-8.
方法二:用 ExcelMethod 2: Excel
- 填入表格后,点"文件 → 另存为",保存类型选 CSV(逗号分隔)(*.csv)。
- 注意:Excel 默认用系统区域的分隔符与编码,中文常存成 GBK,易乱码(见 CSV 乱码修复)。
- 更稳妥:用"数据 → 从文本/CSV"导入,再导出时指定 UTF-8。
- After filling the sheet, "File → Save As", type CSV (Comma delimited) (*.csv).
- Note: Excel uses the system locale's delimiter/encoding; Chinese is often saved as GBK and garbles (see garbled-text fix).
- Safer: "Data → From Text/CSV" to import, then export with UTF-8.
方法三:用 Google SheetsMethod 3: Google Sheets
在 Sheets 里编辑后,点"文件 → 下载 → 逗号分隔值(.csv)",默认即为 UTF-8,中文不易乱码。打开已有 CSV 的方法见 用 Excel/Sheets 打开 CSV。
In Sheets, "File → Download → Comma-separated values (.csv)" — UTF-8 by default, so Chinese rarely garbles. To open an existing CSV see Open CSV in Excel/Sheets.
空白模板示例Blank Template
复制下面的内容存成 .csv 即可直接用:
Copy the block below and save as .csv:
id,name,city,email,phone
1,张三,北京,zhang@example.com,13800000000
2,李四,上海,li@example.com,13900000000
字段命名规范Field Naming Rules
- 用英文或拼音作列名,避免空格(用下划线
_),便于程序读取。 - 不要在字段里换行;含逗号、引号、换行的单元格要用双引号包裹(见 分隔符与引号)。
- 保持每行列数一致,缺值留空但保留逗号。
- Use English/pinyin column names; avoid spaces (use
_) for easy parsing. - Never put newlines inside a field; wrap cells with commas/quotes/newlines in double quotes (see delimiters & quoting).
- Keep the same number of columns per row; leave missing values empty but keep the comma.
务必用 UTF-8 保存Always Save as UTF-8
UTF-8 能同时容纳中英文与符号,是跨平台、跨系统的安全选择。若存成 GBK/ANSI,换台机器打开就可能乱码。想批量从零生成规范 CSV,可直接用 365Lab 的 CSV 生成工具。
UTF-8 holds Chinese, English and symbols safely across platforms. Saved as GBK/ANSI, it may garble on another machine. To generate clean CSV from scratch, use the 365Lab CSV generator.
需要生成示例数据?打开在线生成工具,一键产出符合规范的 CSV 测试文件,全程本地处理。
Need sample data? Open the generator to produce a standards-compliant CSV test file — all local.