Serving CSV files
November 5, 2003 – 10:46 | microsoft(In Windows 2000 + Office 2000)
For a servlet or any other dynamic file generation service that needs to serve a CSV file, the content type, “application/vnd.ms-excel”, is the only one that makes Excel open the file inside IE, but for some reason when Excel does that it doesn’t recognize the CSV format.
On the other hand, when set to “text/csv” (or something like “application/unknown”), IE doesn’t open it in place, but does offer a dialog to either open it in a separate Excel windows, or save it. If the client has “confirm open after download” cleared in the CSV file type settings, IE would directly open it in Excel.
I have also observed that ETrade uses this header to send back an account snapshot:
“Content-Type: application/vnd.ms-excel; extension=CSV”
The additional extension declaration doesn’t help Excel in realizing it’s a CSV file, though - the file is still opened in Excel with each entire line in one field.
