Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What MIME type should I use for CSV?

I've seen application/csv used and also text/csv.

Is there a difference? Does it matter which as long as the request matches something that's available? Are they interchangeable?

like image 539
Steve Dunn Avatar asked Aug 16 '11 09:08

Steve Dunn


People also ask

What type of data works best for CSV format?

CSV files can be used with most any spreadsheet program, such as Microsoft Excel or Google Spreadsheets. They differ from other spreadsheet file types because you can only have a single sheet in a file, they can not save cell, column, or row. Also, you cannot not save formulas in this format.

What is MIME type for all files?

Use "application/octet-stream" for the "All files (*)" filter, since that is the base MIME type for all files.

What is the most common type of CSV file?

Common use cases for exporting CSV files Some programs will give you the option of CSV or PDF such as Gusto's custom report builder, but when it comes to spreadsheet data, just a CSV export is the most common.


2 Answers

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 (tm)

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 recipient's 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 wasn't aware that vendor extensions were allowed. Check out this answer to find out more - thanks starbeamrainbowlabs for the reference.

like image 109
Chris McCauley Avatar answered Sep 19 '22 12:09

Chris McCauley


You should use "text/csv" according to RFC 4180.

like image 42
Smokefoot Avatar answered Sep 19 '22 12:09

Smokefoot