CSV uses tabs instead of commas? How to fix it
Find out whether your file is tab-delimited, open it without merging fields, and save a comma-separated copy without damaging its data.
You open a CSV and find that each row sits in one column, or another app splits the data in the wrong places. The file may use tabs between fields instead of commas. That format is usually called TSV, for tab-separated values, even when someone has given the file a .csv extension.
First check what separates the fields. Then import the file using the right delimiter and export a comma-separated copy. The CSV Editor can help you inspect the result in your browser.
Check how the file is separated
- Open the file in the CSV Editor. Look at whether values from one row appear in separate columns or together in a single field.
- Compare a few rows with what you expect. Check the headers, a row with several values, and a row that contains a comma inside a value, such as an address or description.
- If the data is all in one column, open the original file in a plain text editor as well. Tabs can look like wide spaces, so do not decide based on the gap alone. Check the export settings in the application that created the file, or ask its owner which format it uses.
- Make a copy before converting anything. Keep the original unchanged until you have checked the new file.
A file that is separated by tabs is still readable text, but changing its extension from .tsv to .csv does not change the separators inside it. A receiving program may still treat it as tab-delimited.
What the result means
Each value appears in its own column
The file is being read into fields successfully. If the file looks correct in the CSV Editor but not in another program, the other program may be expecting a different delimiter. Import the file there and choose the delimiter that matches its contents.
A whole row appears in one column
The program probably did not recognize the separator. If the file uses tabs, import it with Tab as the delimiter. If it uses commas, choose Comma. Avoid saving over the original while testing.
Values split at the wrong places
The selected delimiter may be wrong, or the file may contain a mix of formats. A comma inside a value can also be mistaken for a separator if the file is malformed or the import does not handle quoted fields properly. Review the original and test a copy before using the data.
Some columns look right, but later rows shift
Those rows may have a missing separator, an extra separator, or a line break inside a value. Do not fix this by replacing every tab or comma in the file. Check the affected rows against the source data, since a broad replacement can change content as well as separators.
How to convert tab-separated data to CSV
- Import the original with tabs as the delimiter. In the spreadsheet or data application you use, choose its text import option and select Tab. If it asks whether to split at commas, spaces, or another character, do not choose those unless you have confirmed they separate the fields.
- Check the columns before exporting. Confirm that the header fields line up with the values below them. Check rows with empty fields, commas inside text, and longer descriptions. An empty value still takes a position in the row, so make sure later values have not slid into the wrong columns.
- Export a new comma-separated file. Use the application's save or export option and choose CSV or comma-separated text. If it offers a; select Comma. Save under a new name so the original tab-separated file remains available.
- Reopen the exported copy to verify it. Open the new file in the CSV Editor and check that each value appears in the intended column. Also check a row that contains punctuation inside a field. A well-formed CSV can put quotes around a value that contains a comma, so that comma is not treated as a field boundary.
The names and locations of import and export options vary between programs. If you cannot find an import option, search the menus for terms such as Import, Text, or From file. Avoid opening a tab-separated file as though it were already comma-separated and then saving immediately. Depending on the application, it may put the whole row into one cell or alter the layout.
Avoid these quick fixes
- Do not just rename the file. Changing
report.tsvtoreport.csvchanges the name, not the tab characters inside it. - Do not replace every tab with a comma in a text editor. A tab could be part of a field, and a comma can already appear in a value. A spreadsheet import and export is safer because it can preserve fields and add the required quotes around values.
- Do not assume every file called CSV uses commas. Some programs export tab-separated text and label it CSV, or use the computer's regional list separator. Check the actual contents and the export settings rather than relying only on the filename.
- Do not overwrite the source until the copy checks out. Keep both files until the receiving application reads the converted version correctly and the row and column values match the source.
Why tabs and commas get mixed up
CSV means comma-separated values, but people often use the term for any plain-text file arranged in rows and columns. Tabs are wider separators that can be easier to read in some exports, so applications may offer both comma-separated and tab-separated formats. A tab-separated file is commonly called TSV, but the extension alone is not proof of its format.
Comma-separated files also need to handle commas that belong inside a value. For example, a field containing Seattle, WA is commonly enclosed in double quotes so the comma stays part of the field. This is why a proper import and export is safer than manually changing separators: the application can preserve field boundaries and quote values when needed.
The CSV Editor opens files in your browser, and the files stay on your device.
