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:


82 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
    2. https://docs.google.com/uc?export=download&id=0Byu5Yp9Ily0CSHdpc0JacEduV0k applies!
      have you tried it?? it's just as in the OP! However, the file is big and you'll be promted to a info-screen telling you that Google Drive can't scan for viruses, before you download..

      Delete
  31. Thank you! This saved me from a massive headache!

    ReplyDelete
  32. Hi,
    When I click on the hyperlink (in Excel) it opens the file. Is there anyway to get it to download rather than open?

    TIA,
    Moz

    ReplyDelete
    Replies
    1. Sry, this is an off-topic Excel question - consider to search for help at an appropiate discussion/help forum!
      Yours, Kay

      Delete
  33. Thanks! Nice and concise!

    ReplyDelete
  34. Cool, and anyways thanks

    ReplyDelete
  35. How to download video from link like this, plz tell:)
    https://docs.google.com/file/d/0B6mbkcZNa1WnVFlEcmhkVWNxSFU/preview

    ReplyDelete
    Replies
    1. https://docs.google.com/uc?export=download&id=0B6mbkcZNa1WnVFlEcmhkVWNxSFU
      have you tried it?? it's just as in the OP! However, the file is big and you'll be promted to a info-screen telling you that Google Drive can't scan for viruses, before you download..

      Delete
  36. Anyone can help me out with this?

    How can I download this file?

    https://spreadsheets.google.com/pub?key=p8cIl6u115x_c9wSHnFkeYg

    Thanks

    ReplyDelete
    Replies
    1. hi! ..this is not just a simple spreadsheet, it includes java-script and whatelse. I also don't have the sharing-properties, so I can't guess how you would do it!

      Delete
  37. Still valid, and still undocumented by Google. Thanks for sharing!

    ReplyDelete
  38. And this link?
    Help me please. I cant do it :s
    THANKS
    https://docs.google.com/file/d/0B38BaZPTnB6gU1NseUk5UXFQcHM/edit

    ReplyDelete
    Replies
    1. You need to set you're sharing options to "public" or "anyone with the link", as described in the my posting - then try this: https://docs.google.com/uc?export=download&id=0B38BaZPTnB6gU1NseUk5UXFQcHM

      Delete
    2. Ok, thanks you :)

      Delete
  39. Wow! Thanks so much for the post!
    But, what is my individual ID? please ... (I'm a newbie)

    ReplyDelete
    Replies
    1. Your welcome! From reading my post the answer to your question should be clear - if you still have problems you need to give me the link to the file!

      Delete
  40. Can this method be used with wget to download the object?

    ReplyDelete
    Replies
    1. Sorry I don't know - maybe you just give it a try?

      Delete
  41. This is amazing!! Just want to say well done you!

    ReplyDelete
  42. Nice solution! works perfectly!


    solution below shows how to play .mp4 files directly, so to get SOURCE LINK. I have .mp4 file in Google Drive, and I want a link to watch this .mp4 file and not download. same is for .jpg and other MEDIA extensions :)

    simple replace export=download with export=preview


    https://docs.google.com/file/d/0B_e9JkrvgeTeNnZvRTBNWFZlVUE/edit

    for ID I used: 0B_e9JkrvgeTeNnZvRTBNWFZlVUE

    DOWNLOAD link: https://docs.google.com/uc?export=download&id=0B_e9JkrvgeTeNnZvRTBNWFZlVUE
    SOURCE Link: https://docs.google.com/uc?export=preview&id=0B_e9JkrvgeTeNnZvRTBNWFZlVUE

    ReplyDelete
  43. It's not working well for the file that exceeded certain file size. For example, my file https://docs.google.com/uc?export=download&id=0BxK6LimLvhcvQ2JUSXQzLXdtUzg won't download automatically but it will stay and request user to click on the confirm download link.
    The other way https://googledrive.com/host/0BxK6LimLvhcvQ2JUSXQzLXdtUzg is working very well but the downloaded file name is the file id name

    ReplyDelete
    Replies
    1. to my knowledge you can't circumvent this for large files.. I didn't know about the hosting approach - interesting! I can't tell what to do with the changing of the file name..

      Delete
  44. If you have thousands of files stored on Google Drive, what is the best way to generate a list of all of the direct download links ? I have set all of my files as being publicly available if the link is known. How could I fetch all of these links through code? I can do it manually for each file but it would be too much work. I have tried the API but have had no luck.

    ReplyDelete
    Replies
    1. ..no chance for you to use your own hosting service for this?

      Delete
  45. That would be possible however I am attempting to use Google Drive for this as they are very small files and are used as a backup resource if the primary host goes down.

    Do you know if the API allows for the direct download links to be fetched? Or is fetching the link by hand the only method?

    ReplyDelete
    Replies
    1. See my latest posting on this issue! http://thebiobucket.blogspot.co.at/2014/03/download-all-documents-from-google.html

      Delete