タブ区切り(TSV)で分ける
- 選ぶ
- 保存する
データの中に、カンマが含まれていて、CSVだと列がずれてしまう。そんなときに便利なのが、タブで区切る「TSV」です。Excelをシートごとに分ける では、「TSV(タブ区切り)」を選べます。
手順
- 「Excelファイルを選ぶ」で、.xlsx を選びます。
- 「保存する形式」で「TSV(タブ区切り)」を選びます。
- 「シートごとに分けてZIPで保存」を押して、保存します。
CSVとTSVの違い
- CSV:カンマで区切る。もっとも広く使われている。
- TSV:タブで区切る。文章中にカンマがあっても、ずれにくい。
TSVが向いている場面
- 住所や説明文など、カンマを含む文章が多い
- 文章を、そのままデータとして扱いたい
- 貼り付け先が、TSVを前提にしている
TSVを使うときの注意
- 取り込み先が、TSVに対応しているか確かめる
- 文章の中にタブがあると、ずれることがある
- Excelでは、TSVを開くとき、区切り文字の指定が必要な場合がある
スプレッドシートに貼り付けるとき
TSVの内容をコピーして、スプレッドシートに貼り付けると、タブで区切られた列が、自然に各セルに入ります。
向いている場面
- カンマを含む住所のデータを、扱いたい
- スプレッドシートに、表をそのまま貼りたい
例
商品説明文にカンマが多く、CSVでは列がずれた。TSVで分けたところ、列がずれず、システムに取り込めた。
つまずきやすい点
- 取り込み先がTSVに対応していない:CSVで分け直す。
- タブが文章に入っている:事前に、タブを置き換えておく。
よくある質問
TSVの拡張子は何ですか?
.tsv です。メモ帳などでも開けます。
まとめ
カンマを含むデータは、TSV。取り込み先の対応を確かめてから選びましょう。
Excelをシートごとに分けるを使う(無料)あわせて使えるツール
- ExcelをCSV・JSONに変換する:Excelのシートを、CSV・TSV・JSONに変換します。
- CSVをExcelファイルにする:CSVを、Excelで開ける .xlsx ファイルにします。
- Excelの計算式を値にする:Excelの計算式を消して、結果の値だけにします。
同じツールの、ほかの解説
Splitting into Tab-Separated Files
- Choose
- Save
The data contains commas, so with CSV the columns shift. Handy then is "TSV", which separates by tabs. In Split an Excel File by Sheet you can choose "TSV (tab-separated)".
Steps
- Choose an .xlsx with "Choose an Excel file".
- Choose "TSV (tab-separated)" under "Save format".
- Press "Split by sheet and save as ZIP" to save.
Difference between CSV and TSV
- CSV: separated by commas. The most widely used.
- TSV: separated by tabs. Less prone to shifting even if text contains commas.
When TSV suits
- Lots of text containing commas, like addresses and descriptions
- Wanting to handle text directly as data
- The destination assumes TSV
Cautions when using TSV
- Check whether the destination supports TSV
- Tabs within text can cause shifting
- In Excel, opening TSV may require specifying the delimiter
When pasting into a spreadsheet
Copying TSV content and pasting it into a spreadsheet naturally puts the tab-separated columns into cells.
Good for
- Handling address data containing commas
- Pasting a table straight into a spreadsheet
Example
Product descriptions had many commas and the columns shifted in CSV. Splitting as TSV kept the columns aligned and it imported into the system.
Common stumbling blocks
- The destination doesn't support TSV: split again as CSV.
- Tabs are in the text: replace tabs beforehand.
Frequently asked questions
What is the extension of TSV?
.tsv. It can be opened in Notepad and the like.
Summary
TSV for data containing commas. Check the destination's support before choosing.
Use "Split an Excel File by Sheet" (free)Tools that go well with this
- Convert Excel to CSV or JSON: Convert an Excel sheet to CSV, TSV or JSON.
- Convert CSV to Excel (.xlsx): Convert a CSV to an Excel (.xlsx) file.
- Convert Excel Formulas to Values: Replace Excel formulas with their values.