Download To Google Drive From Url

There are lots of benefits to storing files on cloud storage. One of the advantages is that you can share your hosted files with just one link or directly download link.Major free cloud storage services such as Google Drive, Dropbox and OneDrive allow users to control their file access permissions, and users can easily share our personal files by creating a link.

Download the file from the URL. Connect to your Google Drive using the API. Upload the file to your drive. We have shared 4 services with you in this article. Do let us know which one turns out to be the one that you’d wanna use. Also, feel free to tell us about a different service which can also remotely upload to Google Drive. Download the file from the URL. Connect to your Google Drive using the API. Upload the file to your drive. We have shared 4 services with you in this article. Do let us know which one turns out to be the one that you’d wanna use. Also, feel free to tell us about a different service which can also remotely upload to Google Drive.

I am trying to download files from google drive and all I have is the drive's url.

I have read about google api that talks about some drive_service and MedioIO, which also requires some credentials( mainly json file/oauth). But I am unable to get any idea about how its working.

Google Docs

Also, tried urllib2 urlretrieve, but my case is to get files from drive. Tried 'wget' too but no use.

/ed-sheeran-shape-of-you-mp3-download-320kbps.html. Tried pydrive library. It has good upload functions to drive but no download options.

Any help will be appreciated.Thanks.

rkatkamrkatkam

5 Answers

If by 'drive's url' you mean the shareable link of a file on Google Drive, then the following might help:

The snipped does not use pydrive, nor the Google Drive SDK, though. It uses the requests module (which is, somehow, an alternative to urllib2).

When downloading large files from Google Drive, a single GET request is not sufficient. A second one is needed - see wget/curl large file from google drive.

Community
turdus-merulaturdus-merula

Having had similar needs many times, I made an extra simple class GoogleDriveDownloader starting on the snippet from @user115202 above. You can find the source code here.

You can also install it through pip:

Then usage is as simple as:

This snippet will download an archive shared in Google Drive. In this case 1iytA1n2z4go3uVCwE__vIKouTKyIDjEq is the id of the sharable link got from Google Drive.

Drive
ndrplzndrplz

PyDrive allows you to download a file with the function GetContentFile(). You can find the function's documentation here.

See example below:

This code assumes that you have an authenticated drive object, the docs on this can be found here and here.

In the general case this is done like so:

Info on silent authentication on a server can be found here and involves writing a settings.yaml (example: here) in which you save the authentication details.

Robin NabelRobin Nabel

This has also been described above,

This creates its own server too do the dirty work of authenticating

This downloads the file

CAt CorperationCAt Corperation

The above function downloads the file given the file_id to a specified downloads folder. Now the question remains, how to get the file_id? Simply split the url by id= to get the file_id.

ShivendraShivendra

Not the answer you're looking for? Browse other questions tagged pythondownloadgoogle-drive-apiurllib2pydrive or ask your own question.

You can upload files of virtually all types to your Google Drive – from documents to movies to zip archives – and people with whom you have shared the file can easily view them in the browser itself. The Google Docs web viewer is pretty capable and can render all the popular formats including Photoshop files and AutoCAD drawings.

That’s a useful feature but sometimes you may want to bypass the built-in Google Docs viewer and force the browser to download the file instead of opening it. Thus if a user has Photoshop on their computer, the PSD file that you have shared through Google Drive will open in Photoshop and not in their web browser.

Create Direct Links and Skip the Web Viewer

Google Drive doesn’t offer a simple option for creating these “direct download” link but you can easily create them by slightly modifying the generated URLs. Here’s the trick.

A file hosted on Google Drive has a shared link that looks like this:

When you access this link, it will render the file in the browser but if you can rewrite this URL slightly, the link, when clicked, will download the corresponding file in the user’s browser instead of opening it in the browser. The modified URL would be:

All you have to do is make note of the FILE_ID in the original URL and use it in the modified URL. For example, here’s an image file hosted on Google Drive that will open in the browser and here’s the modified URL that forces the browser to download the file.

Direct Download Links for Google Documents

The trick works for native Google Documents too though the URL format is a little different.

Google Docs: When you share a Google document, the URL would be:

Replace /edit with /export and add the file format that the document should be saved as and your download link is ready.

The above links will now download the same Google document in Word (.docx) and PDF formats. You can also use “txt”, “html” and “odt” for the download format.

Google Presentations: Google Docs offer an even simpler URL scheme for creating direct links to Google Presentations. The original shared links are of the following format:

Download to google drive from url download

The direct links for downloading the same presentation deck in PowerPoint (.pptx) and PDF formats are below:

Google Spreadsheets: Open your Google Spreadsheet in the browser, make the sheet Public (or Anyone with a link) and make a note of the shared URL. It should be something like this:

The direct download links use a similar format as Google Documents and will read like:

Bonus Trick – Make a Copy

Google Spreadsheets offers an additional feature that is not available in Documents and Presentations (at least yet). You can create links to Google Sheets that will automatically create a copy of your Google Sheet in the Google Drive of the person with whom you have shared the sheet.

Download To Google Drive From Url Mac

The newcopy=true parameter did the trick.

Google Drive Download Url

You'll also like: