http headers – What MIME type should I use for CSV?

http headers – What MIME type should I use for CSV?

RFC 7111

There is an RFC which covers it and says to use text/csv.

This RFC updates RFC 4180.

Excel

Recently I discovered an explicit mimetype for Excel application/vnd.ms-excel. It was registered with IANA in 96. Note the concerns raised about being at the mercy of the sender and having your machine violated.

Media Type: application/vnd.ms-excel

Name Microsoft Excel ™

Required parameters: None

Optional parameters: name

Encoding considerations: base64 preferred

Security considerations: As with most application types this data is
intended for interpretation by a program that understands the data on
the recipients system. Recipients need to understand that they are at
the mercy of the sender, when receiving this type of data, since
data will be executed on their system, and the security of their
machines can be violated.

OID { org-id ms-files(4) ms-excel (3) }

Object type spreadsheet

Comments This Media Type/OID is used to identify Microsoft
Excel generically (i.e., independent of version, subtype, or platform format).

I wasnt aware that vendor extensions were allowed. Check out this answer to find out more – thanks starbeamrainbowlabs for the reference.

You should use text/csv according to RFC 4180.

http headers – What MIME type should I use for CSV?

Strange behavior with MS Excel:
If i export to text based, comma-separated format (csv) this is the mime-type I get after uploading on my webserver:

[name] => data.csv
[type] => application/vnd.ms-excel

So Microsoft seems to be doing own things again, regardless of existing standards: https://en.wikipedia.org/wiki/Comma-separated_values

Leave a Reply

Your email address will not be published.