Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a number of .csv files. Some of them are comma delimited, some are tab delimited (maybe they should be called .tsv ...)

The csv extension gets associated with Excel when Excel is installed. However, if I open one of these files with excel, everything gets dumped into the same column and the comma is not interpreted as a delimiter.

I can instead of File -> Import..., select the file, and choose the precise way to interpret the contents (delimiters, data types, etc.) But most of the time I just want to look at the file through a clear table view. I do not want to process it with Excel.

Is there a way to get Excel to auto-interpret the delimiter and show the CSV file as a proper table as soon as it's opened? I need this so I can use Excel as a quick viewer for such files.

I suspect there must be a way, otherwise Excel wouldn't associate itself with CSV files.

share|improve this question

2 Answers 2

up vote 8 down vote accepted

While opening CSV files, Excel will use a system regional setting called List separator to determine which default delimiter to use.

Microsoft Excel will open .csv files, but depending on the system's regional settings, it may expect a semicolon as a separator instead of a comma, since in some languages the comma is used as the decimal separator. (from Wikipedia)


On Windows, you can change the List separator setting in the Regional and Language Options as specified on the Office support website :

Change the separator in a CSV text file

  1. Click the Windows Start menu.
  2. Click Control Panel.
  3. Open the Regional and Language Options dialog box.
  4. Click the Regional Options Tab.
  5. Click Customize.
  6. Type a new separator in the List separator box.
  7. Click OK twice.

On Mac OS X, this setting seems to be deduced from the decimal separator setting (in the language pane of system preferences). If the decimal separator is a point then the default CSV separator will be a comma, but if the decimal separator is a comma, then the default CSV separator will be a semicolon.

As you said yourself in the comment, there is an alternative for Mac users to quickly look at those CSV files. It's plugin for Quick Look called quicklook-csv that handles separator detection.

share|improve this answer
    
Thanks, this makes sense. I guess then it just won't interpret tabs as delimiters by default (which also makes sense as CSV stands for Comma Separated Values, but people do use tabs in CSVs in practice and I need to deal with that). –  Szabolcs Jun 11 '13 at 11:17
    
@Szabolcs Excel won't try to detect the delimiter while opening a CSV file (using file->open or the explorer), it will just use the system setting. It will however manage to detect automatically the delimiter (tab, comma, semicolon or space) while using the import feature. –  zakinster Jun 11 '13 at 11:29
    
I ended up looking for a different program to view these files quickly and went with this: code.google.com/p/quicklook-csv Otherwise you are correct about why it wouldn't handle commas. –  Szabolcs Jun 11 '13 at 11:50
    
@Szabolcs Since you're on OSX and not on Windows, I updated my answer to be less specific, and I included your suggestion for potential future visitors. –  zakinster Jun 11 '13 at 12:13
    
Your answer was valid on OS X too: it's still the decimal point/comma that causes the "trouble" (as you mention in the answer). –  Szabolcs Jun 11 '13 at 13:46

If you are not looking to modify the file, you can use the following Excel trick to help you.

Add a new line (alone) with the text "sep=," in order for the Excel to open the file with "," as the list separator.

It´s a very easy trick to avoid changing your complete windows configration regional settings.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.