Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force download link on a google docs spreadsheet

Is there a way to force a download link instead of the browser trying to open the file? In this case I have a docs spreadsheet and a some links to mp3 files. I want the users to download these files instead of the browser playing it. The mp3's are hosted on another site. Thanks, Bo

like image 622
Bo. Avatar asked May 19 '11 11:05

Bo.


2 Answers

To make download links for documents - https://docs.google.com/feeds/download/documents/Export?docID=yourDocId

To make download links for any file - https://docs.google.com/uc?id=yourDocId&export=download&hl=en_US

To make download links for spreadsheets - https://spreadsheets.google.com/feeds/download/spreadsheets/Export?key=yourDocId&exportFormat=csv

For further information please go here


UPDATING IN 2018

The new download URL is
  https://docs.google.com/spreadsheets/d/<KEY>/export?gid=<GID>&format=csv
where <KEY> and <GID> can be obtained from your navigation's URL,
  https://docs.google.com/spreadsheets/d/<KEY>/edit#gid=<GID>

PS: spreadsheets (workbook) may have multiple sheets (worksheets), GID is the desired sheet ID. One-sheet-spreadsheet usually has gid=0, but if you add more they'll have random numbers (the GID is preserved even changing tab-order).

So, using wget or curl you can test,

   wget --no-check-certificate -O test.csv \
    'https://docs.google.com/spreadsheets/d/0At2sqNEgxTf3dEt5SXBTemZZM1gzQy1vLVFNRnludHc/export?gid=0&format=csv'
like image 51
Mokarom Avatar answered Sep 21 '22 03:09

Mokarom


To expand on Mokarom's answer (because I can't comment) you need to replace the part of those links that say "yourDocId" with the document id of the page you're trying to download. This is the key= part of the url.

For example, if you had a spreadsheet at https://docs.google.com/spreadsheet/ccc?key=0AhjOs40Xk1-4dGg0MjMVYURPMFRpeUFhbmZBTkZ0dEE#gid=8, then you would go to https://spreadsheets.google.com/feeds/download/spreadsheets/Export?key=0AhjOs40Xk1-4dGg0MjMVYURPMFRpeUFhbmZBTkZ0dEE&exportFormat=csv for the download link.

like image 42
nyctef Avatar answered Sep 24 '22 03:09

nyctef