how to programmatically download a public Google Drive file?
Asked Answered
K

2

15

I have a backend server that has to download a file on Google Drive that has been shared to public by the owner. Our clients are emailing us the link and we get the link from the email -- no UI is involved. The program needs to get or download the file and process it offline .

The google samples seem to be runnig using the UI where as this is a automated backend process.Also, this application is to running on my server and not on Google App Engine . Do I still need to register my app if all I am doing is acessing files shared to public by the owner.

For reference , please note that it is trivial to download /wget a file shared on Dropbox .

Kentigera answered 26/6, 2012 at 20:10 Comment(2)
Can you make it clearer why you can't just wget the url the client has emailed you?Bleeder
@Bleeder the URL's Google Drive sends out are not links to the actual file, but to a webpage where you can view the file. There doesn't seem to be a way to fetch the file from the URL.Polyneuritis
H
1

You don't need any Google SDK if you know the link and the file is public. Just use a standard HTTP GET method to download the file.

Heimer answered 4/7, 2012 at 8:13 Comment(2)
This doesn't work for me. Note: it was a very large file that was beyond the limit for automatic antivirus scan, so there was an intermediate page before the link.Dulin
what should be the request parameters?Fai
M
8

This is an older question (and already has an accepted answer), but Google just announced a new way to tackle this problem that makes it quite a bit easier to solve; basically, you can now (as of 11/28/2012) make a folder and set the folder to be public, and then any file put in the folder can be downloaded via HTTP GET without ever getting an intermediate page (regardless of the filesize). Details:

http://googleappsdeveloper.blogspot.com/2012/11/announcing-google-drive-site-publishing.html

Maddis answered 29/11, 2012 at 6:2 Comment(0)
H
1

You don't need any Google SDK if you know the link and the file is public. Just use a standard HTTP GET method to download the file.

Heimer answered 4/7, 2012 at 8:13 Comment(2)
This doesn't work for me. Note: it was a very large file that was beyond the limit for automatic antivirus scan, so there was an intermediate page before the link.Dulin
what should be the request parameters?Fai

© 2022 - 2024 — McMap. All rights reserved.