轉換以製表符或分號分隔的資料
要點
- 選擇
- 轉換
Even called CSV, the separator is not always a comma. There is data separated by tabs, and data separated by semicolons. In Convert CSV and JSON, you choose the "Delimiter (CSV)" and convert.
步驟
- 選擇「方向」。
- For "Delimiter (CSV)", choose from "comma", "tab" and "semicolon".
- Paste the data into "Before conversion".
- Press "Convert" and check the result.
Data copied from Excel is tab-separated. Set the delimiter to "tab" and convert.
The three delimiters
- Comma (,): ordinary CSV.
- Tab: data copied from Excel or spreadsheets. Also called TSV.
- Semicolon (;): CSV used in countries such as those in Europe, mostly where a comma is the decimal separator.
如何判斷
Look at the pasted data and check what separates the items.
- Items separated by commas → comma
- A wide gap between items (tab) → tab
- Items separated by semicolons → semicolon
If the delimiter is wrong
The whole line becomes one item and doesn't split cleanly. If the result is odd, change the delimiter and try again.
When copying from Excel
- In Excel, select the range to convert and copy.
- Paste into "Before conversion".
- Set the delimiter to "tab" and convert.
When items contain commas
If the data contains commas (addresses, for example), changing the delimiter to tab is safer. Or use a format with items enclosed in double quotes.
適合
- Pasting Excel data as it is and converting
- Converting CSV output from overseas systems
- Handling data whose items contain commas
示例
Copied and pasted an Excel table but it didn't split well. Changing the delimiter to "tab" converted it cleanly.
Common stumbling blocks
- The whole becomes one item: the delimiter doesn't match.
- Decimal points get mixed in: semicolon-separated with commas as decimal points.
Frequently asked questions
Is the delimiter detected automatically?
It is not detected automatically. You choose it.
小結
Match the delimiter to the data. Copies from Excel are tab-separated.
使用「CSV 與 JSON 互相轉換」(免費)搭配使用的工具
- 刪除重複行並排序:刪除重複的行並排序。
- 把檔案打包成 ZIP:把多個檔案打包成一個 ZIP。
- 文字數統計(用於求職申請表和報告):統計文字的字數、行數和稿紙張數。