1
votes

Using the HTML (div to load plusone.js) approach, is it possible to set the MIME Type of the generated Google Drive file?

Background

I'm trying to download CSV documents into Google Drive. I want customers to be able to open these files in Google Sheets with just a single click. Google Drive does not associate .csv files with Google Sheets automatically which means customers have to click here and there before they get the documents to open (not so good for my business). I tried serving the documents with Google Sheets custom MIME Type application/vnd.google-apps.spreadsheet but it seems Drive completely ignores it.

If manipulating MIME Types won't work, I'll like to know any other means of associating generated files with Google Sheets such that customers can open generated documents automatically with a single click.

NB: I know its possible to set MIME Types in the Javascript and server-side flows using the Drive API and I have experience with the Drive API so please lets skip that :) I just want to get this done in the HTML flow.

Thanks.

1

1 Answers

2
votes

Turn on conversion during uploads with convert parameter.

POST https://www.googleapis.com/upload/drive/v2/files?uploadType=media&convert=true