UDC-VIT

Download

How do I download a very large file from Google Drive?

Here are step-by-step instructions to download a file from Google Drive using the command line API if the file is shared privately and needs authentication.

1. Get the File ID

  1. Open your Google Drive in a web browser.
  2. Right-click (or control-click) the file you want to download and click “Get shareable link”. The link looks like this: https://drive.google.com/file/d/XXXXX/view?usp=sharing. Make note of the file ID “XXXXX”; you will be needing it below.

2. Get an OAuth Token

  1. Go to the OAuth 2.0 Playground.
  2. In the “Select the Scope” box, scroll down, expand “Drive API v3”, and select https://www.googleapis.com/auth/drive.readonly
  3. Click “Authorize APIs” and then “Exchange authorization code for tokens”. Copy the “Access token”; you will be needing it below.

3. Download the file from the command line:

In your command, replace “XXXXX” with the file ID from above, “YYYYY” with the access token from above, and “ZZZZZ” with the file name that will be saved (for example, “myFile.mp4” if you’re downloading an mp4 file).

Press Enter and let the download begin.


Adapted from a Quora answer by Shane F. Carr, Software Engineer at Google.