Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

How can I set up an OS X install so that .csv files are viewed in quicklook just as if they were .txt (plain text) files?

At the moment they just show up as a generic blank document unless you manually change the extension to .txt.

I did find this post which covers the same issues and offers some thoughts, but never really comes to any resolution.

share|improve this question
    
Apparently it's a problem with OS X and .csv being associated to Excel or Numbers. It's odd, and I have been trying this myself. The solution proposed in the thread you suggest does work, but it's annoying. :( –  Martín Marconcini May 10 '09 at 23:26
    
Funny, it works fine for me. They look exactly like I'd opened them in Preview or gvim. –  Paul Tomblin May 11 '09 at 0:08
    
Ok, I take that back. One of the several .csv files in my Documents directory doesn't display, I just get a file icon that says "OpenOffice.org document". The other three think they're associated with Excel and show up correctly. –  Paul Tomblin May 11 '09 at 0:09
    
This is the kind of thing the /Library/QuickLook folder is made for, but alas I can't find any CSV plugins on Mr Google :-( –  username May 11 '09 at 0:24
    
I suspect that installing openoffice.org was what messed them up for me:/ –  Lawrence Johnston May 11 '09 at 0:31

4 Answers 4

up vote 2 down vote accepted

Since I have many CSV files, I decided that it's time for a real Plugin for these. Maybe someone else finds this useful, it's OSS: http://code.google.com/p/quicklook-csv/

share|improve this answer
    
Nice, I like this one. Great job. –  Lawrence Johnston Jul 20 '09 at 3:38
    
Thanks! Glad there's indeed use for this. :) –  Pascal Sep 11 '09 at 14:58

Of note, Mac OS X 10.6 Snow Leopard now provides proper QuickLook support .csv files. It shows them as if they were opened in a spreadsheet. (Part of the same generator that shows Word, PowerPoint and Excel documents natively without Office itself installed)


Force Quick Look .csv files:

CSVQL.qlgenerator (Source Code)

While far from ideal I put together a QuickLook generator. It's been tested on both Intel and PPC computers running 10.5.6. There should be someway to just add .csv to be recognized as plain text somehow - as some generators already handle .csv but break when the file is not assigned to them.

It's possible to have an application tell LaunchServices to treat said file as a plain text file (UTTypeConformsTo definitions) but it needs to be defined in the Application's Info.plist - hence the issue you run into when the file is not assigned to open in any application, or the incorrect application

The other alternative is manually running quick look from the command line does work:
qlmanage -c public.plain-test PATH_TO_CSV_FILE

A quick primer for how QuickLook works for those curious:
When choosing to quick look a file the quick look daemon (qlmanage -p from the command line) will look at the file and dependent on the application designed to open it look for a generator in one of 4 places. The application itself (Application.app/Contents/Library/QuickLook), ~/Library/QuickLook, /Library/QuickLook, and lastly /System/Library/QuickLook.

The system defaults can be found at /System/Library/Frameworks/QuickLook.framework/Resources/Generators/

Generators are identified by the UTI (Uniform Type Identifiers) of the file - the biggest issue is that comma separated values are not automatically defined as a known UTI in 10.5.

For the more fun details about creating QuickLook generators and how they work, check out developer.apple.com

share|improve this answer
    
This does indeed work. Thanks! –  Lawrence Johnston May 12 '09 at 2:15
    
nice, excellent answer –  username May 12 '09 at 21:18
    
:-) The best knowledge is that shared. –  Chealion May 12 '09 at 22:07
    
Pascal's answer comes up with a much nicer plug-in that he made this past weekend. –  Chealion Jul 5 '09 at 21:34

Since I can't find a CSV Quicklook plugin for you, my suggestion is to roll your own. There's a tutorial here: http://www.youtube.com/watch?v=GMNSU-PIoOo As far as coding projects go, it doesn't look too hard.

Won't work. As you suspected, Firefox isn't adding the type/creator when you download the file. You will indeed need to change it manually. The Mozilla website suggests contacting the site owner when the "wrong" Mimetype is used :-( Additionally the only "Mimetype" FFox plugins I can see only give you control over whether the browser should download or open the file, (and what app to open it with). You're out of luck.

share|improve this answer
    
Thank you for the helpful information. –  Lawrence Johnston May 11 '09 at 1:36
    
No problem. Btw, I also tried experimenting with "Default Apps" (it's a freeware System Preference Pane for changing which types of files are opened by which types of apps) - but no luck there either. –  username May 11 '09 at 2:09
    
The QuickLook plugin works for me if you base it off the filename's extension. –  Chealion May 11 '09 at 21:28

First of all, decide which application you would like to have open when double clicking on a file with the .csv extension. The Get Info window will let you specify the default application for that file extension.

Modify that application's Info.plist file by following the steps given in this hint: http://hints.macworld.com/article.php?story=20071028184428583

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.