12 Oct 2011

How to Link to Files at Google Docs for Direct Download

...Google doesn't tell you this, as far as I know - so, if you want to link to a file at Google Docs for direct download you can use the following address scheme:

https://docs.google.com/uc?export=download&id=YourIndividualID

You can copy your individual file id from within the "Share..."-dialogue. Here you also need to put the share settings to "public" or to "anyone with the link"

a HTML example for this link to a pdf-file:


53 comments:

  1. Thanks. Nice and concise hint. All I needed!

    ReplyDelete
  2. thank you!!! this solved my problem!

    ReplyDelete
  3. Finally I found what I was looking for, Thanks!

    ReplyDelete
  4. Thanks mate, great simple tip. I have no idea why Google doesn't tell people these things, or just put them as a sharing option.

    ReplyDelete
  5. Thanks mate, nice and concise how-to there. It helped me solve a problem thats been annoying me for some time now. If only Google would tell people about stuff like this.

    Cheers once again

    ReplyDelete
  6. This doesn't work for me. I'm trying to create a download link for my shared txt file:
    https://docs.google.com/document/d/18zYsi9T7DxKBWo2Ig0jsLPvH_PLMevxRq1FfKftxBVw/edit

    Is
    18zYsi9T7DxKBWo2Ig0jsLPvH_PLMevxRq1FfKftxBVw

    the id?

    Please help

    ReplyDelete
    Replies
    1. ..this should be the id - tried it and can't get it to work either. Sry, but I can't tell why this is.

      Delete
    2. Why - it's simple. Text can be converted; I suspect it actually was already converted to Google Docs' internal rich text format when uploading; all we need is format specifier for download.

      Delete
    3. Solution:
      https://docs.google.com/document/export?format=txt&id=18zYsi9T7DxKBWo2Ig0jsLPvH_PLMevxRq1FfKftxBVw
      i.e.
      https://docs.google.com/document/export?format=&id=
      (IMHO /uc/ means UnCategorized)

      Delete
    4. /document/
      here is specifier for internal Google Docs rich text format, other is /spreadsheet/, etc.

      Delete
  7. Great!
    works great!
    thanks a lot!

    ReplyDelete
  8. quick question:
    how did you come by this information???
    thanks in advance.

    www.razmovich.com

    ReplyDelete
  9. Thank you so much!! :)

    ReplyDelete
  10. Thank you. This helped me :)

    ReplyDelete
  11. Unfortunately, it doesn't work with large files because of anti-virus protection.

    ReplyDelete
    Replies
    1. just add &confirm=no_antivirus before &id=

      Delete
  12. Hi, I'm trying to download the file provided by that shared link programmatically. However, it does not work for large files. Even when I go to browser and enter that link, I'm redirected to the anti virus page and have to click on Download Anyway (which is the same exact link) and then subsequent requests to that link will download the file. Does anyone know a workaround for this?

    ReplyDelete
    Replies
    1. the anonymous' post of may the 9th doesn't help either?

      Delete
  13. I used this link format https://docs.google.com/uc?export=download&confirm=no_antivirus&id=xxx. I think google requires a cookie in order for you to download a large file. If I disable cookies, repeatedly visiting the links will show the same download page, but if I go there once and the cookie is stored, going to the link again would open up the download dialog.

    ReplyDelete
    Replies
    1. For those of you who need help doing this programmatically, I was able to download a large file by getting the cookie returned by the link, and after setting the cookie I was able to download the file.

      Delete
    2. Is there no way todo it within a URL?

      Delete
  14. Thank you so much! Very helpful and specific.

    ReplyDelete
  15. how about this
    https://docs.google.com/spreadsheet/viewform?formkey=dEM5SThLZWwxdFlrM3pEc3VkNG84cFE6MQ#gid=3

    ReplyDelete
  16. Say I have a Google Document that I want to have the direct download link be a PDF, is there a syntax that would allow such a thing? Can Google Drive convert the file from a Google Doc to a PDF when the direct download link is used?

    ReplyDelete
    Replies
    1. Go to Google Drive, choose 'Download as PDF', then go to the list of downloads (in Firefox, crtl-J), then right click on file and copy the download link.. Tried it, and it works:
      LINK

      Delete
  17. Awesome. This works withh the google docs viewer (https://docs.google.com/viewer), too. Add &embedded=true for less chrome and faster loading.

    ReplyDelete
  18. How do you determine what the id=YourIndividualID is?

    ReplyDelete
    Replies
    1. Just grab it from the link to your file after 'sharing' it..

      Delete
  19. Hi!

    I just dont get it. I do have a googel-docs documetn and i want a link so that someone can download the file as pdf.

    Is this pssible?

    Here are the ID

    1eq0pKBCDi0XuTnFHfs4EylWt3QU-6bwRarBHM2ctKVQ

    and the link to the doc

    https://docs.google.com/a/tg-ibb.de/document/d/1eq0pKBCDi0XuTnFHfs4EylWt3QU-6bwRarBHM2ctKVQ/edit

    ReplyDelete
    Replies
    1. Try this:
      https://docs.google.com/document/d/1eq0pKBCDi0XuTnFHfs4EylWt3QU-6bwRarBHM2ctKVQ/export?format=pdf&id=1eq0pKBCDi0XuTnFHfs4EylWt3QU-6bwRarBHM2ctKVQ&token=AC4w5VjgXm_L6atDjjNumj-TdiiQxcTG2Q%3A1358028088190

      Delete
  20. thanks bro...its working,but there is a little problem when downloading with IDM it shows the problem of same file name(uc) each time downloading.how to overcome it...please reply...

    ReplyDelete
    Replies
    1. Sorry, I got no idea and can not replicate your problem..

      Delete
  21. Many thanks...this works, cool :)

    ReplyDelete
  22. Hi there,

    This seems to work when I use Firefox, but when I use safari, this code:

    https://docs.google.com/uc?export=download&id=YourIndividualID

    leads to a sign in at this url:

    https://accounts.google.com/ServiceLogin?service=writely&passive=1209600&continue=https://docs.google.com/uc?export%3Ddownload%26id%3DYourIndividualID&followup=https://docs.google.com/uc?export%3Ddownload%26id%3DYourIndividualID&ltmpl=homepage

    Tried the anti-virus fix, no go. Plus, the file isn't huge.

    ReplyDelete
    Replies
    1. I don't think this is a Safari issues. However, you could try downloading from Google-Docs/Drive from within the usual dialog. Then, from the download window that shows you're downloaded files copy the URL by right-clicking on the file. I tried this approach in Safari and it works..

      Delete
  23. This is exactly want I was looking for. I have PDF files stored in my Google Drive that I want linked to on my website. Normally, the browser would just open the PDF for reading, which isn't exactly what I wanted. I wanted the file to download to the user's computer/tablet. This post told me exactly what I needed to do, and it worked. Thank you!

    ReplyDelete
  24. It works, but for large files, there's no way to get rid of the virus warning the first time a person views the file.

    ReplyDelete
  25. Hey! I've tried your method but it doesnt seem to be working for me. could you help me with this?

    I'm trying to download this file

    https://docs.google.com/file/d/0B6k3lX6jF479RzhEeUtHel9YQms/edit?pli=1

    Thank you!!!

    ReplyDelete
    Replies
    1. Google says there's no permission to download. Check if you put the Share Options correctly (something along the lines: "Public, anyone can access/download..").

      Delete
  26. Thanks for this tip! Better yet, leave off the "export=download" part and you'll just get a direct link to the file. Your browser will display or download as appropriate for the filetype.

    ReplyDelete
  27. works after one day? I mean id/token don't expires after 1day?

    ReplyDelete
  28. Works perfectly, thanks for the tip !! :)

    ReplyDelete
  29. CANNOT THANK YOU ENOUGH. It works like a charm. How many years have I been doing this the hard way? Wonderful.

    ReplyDelete
  30. hey i have the link https://docs.google.com/file/d/0Byu5Yp9Ily0CSHdpc0JacEduV0k/preview?pli=1 ,this is a video and i want to download it is uploaded by a blogspot and i want to download it pls tell me the steps.....thanks in advanced

    ReplyDelete
    Replies
    1. please show me the link to the file instead of the preview!

      Delete