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:


98 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
    5. It worked for me: https://docs.google.com/document/export?format=&id=

      I had to change "document" to "spreadsheet" in my case.

      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. This helped me :)

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

    ReplyDelete
  11. 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
  12. 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
  13. Thank you so much! Very helpful and specific.

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

    ReplyDelete
  15. 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
  16. Awesome. This works withh the google docs viewer (https://docs.google.com/viewer), too. Add &embedded=true for less chrome and faster loading.

    ReplyDelete
  17. 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
  18. 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
  19. 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
  20. Many thanks...this works, cool :)

    ReplyDelete
  21. 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
  22. 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
  23. 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
  24. 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
  25. 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
  26. works after one day? I mean id/token don't expires after 1day?

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

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

    ReplyDelete
  29. 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
    3. add
      &confirm=FfRC
      before
      &id
      and it'll work :)

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

    ReplyDelete
  31. 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
  32. Thanks! Nice and concise!

    ReplyDelete
  33. Cool, and anyways thanks

    ReplyDelete
  34. 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
  35. 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
  36. Still valid, and still undocumented by Google. Thanks for sharing!

    ReplyDelete
  37. 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
  38. 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
  39. 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
  40. This is amazing!! Just want to say well done you!

    ReplyDelete
  41. 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
  42. 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
  43. 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
    2. If you use Linux, you may try this: https://github.com/noureddin/gdrive-dl

      Delete
  44. 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
  45. This is just what I've needed. Many of our site users are elderly and cannot figure out google drive. They are happy downloading files. Any chance there is a secret to linking a folder for download as zip? The folder is public but the resulting link requires login. I copied the download link and have tried various versions based on this post and comments. Any help would be great!

    ReplyDelete
    Replies
    1. Sorry for the late answer: To my knowledge there is no way to create a download-link for folders!

      Delete
  46. thanks lot my dear friend very good job

    ReplyDelete
  47. its work thank you. nice share

    ReplyDelete
  48. Is it possible to embed an interactive excel sheet with simple formula. Where people enter values and get results.

    For example.
    6/x=y
    when someone enters an x value he will get results as Y.
    How do I embed such a formula and publish it on my site for someone to use it

    Thanks
    Mike

    ReplyDelete
    Replies
    1. Why would you use a spreadsheet for that??

      Delete
  49. which is useful for me dude. Thanks alot

    ReplyDelete
  50. Big help. Thank you.

    ReplyDelete
  51. useful information, thank you for the post!

    ReplyDelete
  52. Very big help . Thank you

    ReplyDelete
  53. thanks my friend, I've been looking for months.

    ReplyDelete