[ACCEPTED]-What to set as mimetype for CSV files to open in spreadsheet applications-mime-types

Accepted answer
Score: 69

Try this:

Content-Type: text/csv; name="filename.csv"
Content-Disposition: attachment; filename="filename.csv"

In Windows browsers the MIME type 10 is ignored after the file is downloaded 9 and only file name extension is used to 8 determine the corresponding application.

Also, making 7 .CSV file open in Excel correctly is hard, because 6 the default separator is taken from Regional 5 settings on the machine on which the CSV 4 is opened. Furthermore, the encoding is 3 not determined from the file content or 2 MIME type, so any non-ASCII characters are 1 hard to get working.

Score: 3

Filip's answer is very good.

I would expand 4 it regarding the separator. You can define 3 the separator in first line (it must be 2 the first line) of your csv file using sep. It 1 looks like this:


More Related questions