CSVを開くと文字化けするとき
- 変換する
- 開く
システムから出力したCSVを、Excelで開いたら、日本語が「縺ゅ>縺…」のような文字化けになった。CSVをExcelファイルにする でExcelファイルにすれば、文字化けせずに開けます。
手順
- 「CSVファイルを選ぶ」で、CSVを選びます。
- 「区切り文字」は、「自動で判定」のままで構いません。
- 「Excelにして保存」を押して、保存します。
- できた.xlsxを、Excelで開きます。日本語も、文字化けせずに表示されます。
文字化けの原因
CSVは、ただの文字のファイルです。文字をどの方式(文字コード)で書き込んだかによって、読み取る側が、違う方式で読むと、文字化けします。
- UTF-8:多くのシステムで使われる。Excelが、そのままでは正しく読めない場合がある。
- Shift_JIS:日本の古いシステムで使われる。
このツールで直る理由
このツールは、CSVの文字を読み取ってから、Excelファイルとして新しく書き出します。Excelファイルの中では、文字は正しい形で保存されるため、開くときに文字化けしません。
それでも文字化けするとき
- CSVを読み込む時点で、すでに崩れている
- 元のCSVが、特殊な文字コード(EUC-JPなど)で作られている
- 元のファイルが、別の変換で壊れている
この場合は、元のシステムで、文字コードを指定して、出力し直せないか確認します。
貼り付けで試す
ファイルを選んで文字化けしたら、テキストエディタで開いて、内容をコピーし、「CSVの内容」に貼り付けてみます。
向いている場面
- 会員システムや、通販サイトのCSVを開きたい
- 取引先から届いたCSVを、見たい
例
通販サイトから出力した注文CSVが、Excelで開くと文字化けした。このツールでExcelに変換したところ、商品名の日本語がきれいに表示された。
つまずきやすい点
- 変換しても化ける:元のCSVが、特殊な文字コードの可能性。
- 一部の文字だけ化ける:環境依存文字や、絵文字の可能性。
よくある質問
変換すると、データは変わりますか?
いいえ。中身は同じで、Excelの形式になるだけです。
まとめ
CSVの文字化けは、.xlsxにして開くと避けられます。それでも化けるときは、元の出力設定を見直しましょう。
CSVをExcelファイルにするを使う(無料)あわせて使えるツール
- ExcelをCSV・JSONに変換する:Excelのシートを、CSV・TSV・JSONに変換します。
- CSVとJSONを相互変換する:CSVとJSONを、すぐに相互変換します。
- 重複した行を消す・並べ替える:重複した行を消して、並べ替えます。
同じツールの、ほかの解説
When a CSV Looks Garbled
- Convert
- Open
A CSV output from a system opened in Excel showed Japanese garbled like "縺ゅ>縺…". Turning it into an Excel file with Convert CSV to Excel (.xlsx) lets it open without garbling.
Steps
- Choose the CSV with "Choose a CSV file".
- The "Delimiter" can stay at "Detect automatically".
- Press "Make Excel and save" and save.
- Open the resulting .xlsx in Excel. The Japanese displays without garbling.
Cause of garbling
A CSV is a plain text file. Depending on the method (character encoding) used to write the characters, if the reading side reads with a different one, the text garbles.
- UTF-8: used by many systems. Excel may not read it correctly as it is.
- Shift_JIS: used by older Japanese systems.
Why this tool fixes it
This tool reads the CSV's characters and then writes them out anew as an Excel file. Inside the Excel file the characters are stored in the correct form, so they don't garble on opening.
When it still garbles
- It was already broken at the point of reading the CSV
- The original CSV was made in an unusual encoding (such as EUC-JP)
- The original file was broken by another conversion
In that case, check whether you can output again from the original system specifying the encoding.
Trying by pasting
If choosing the file garbles it, open it in a text editor, copy the content and paste it into "CSV content".
Good for
- Opening CSVs from membership systems or online shops
- Viewing CSVs received from business partners
Example
An order CSV output from an online shop was garbled when opened in Excel. Converting it to Excel with this tool displayed the Japanese product names cleanly.
Common stumbling blocks
- Still garbled after converting: the original CSV may use an unusual encoding.
- Only some characters garble: possibly platform-dependent characters or emoji.
Frequently asked questions
Does converting change the data?
No. The content is the same and just takes Excel's format.
Summary
CSV garbling can be avoided by making it .xlsx and opening that. If it still garbles, review the original output settings.
Use "Convert CSV to Excel (.xlsx)" (free)Tools that go well with this
- Convert Excel to CSV or JSON: Convert an Excel sheet to CSV, TSV or JSON.
- Convert CSV and JSON: Convert between CSV and JSON instantly.
- Remove Duplicate Lines and Sort a List: Remove duplicate lines and sort them.