Google Drive Public File/Folder Downloader
Project description
Why?
Downloading public files from Google Drive with curl or wget doesn't work — Google serves a confirmation page for large files, and the URL formats are a mess.
gdown gets around that:
- Skips the virus-scan confirmation page so large downloads actually finish
- Downloads folders recursively
- Exports Google Docs/Sheets/Slides as PDF, DOCX, CSV, etc.
- Resumes partial downloads with
--continue - Also works with plain HTTP/HTTPS URLs as a curl/wget replacement
Install
Requires Python 3.10 or later.
pip install gdown
Or with uv:
uv tool install gdown
Quick start
# Just paste a Google Drive URL
gdown https://drive.google.com/uc?id=1l_5RK28JRL19wpT22B-DY9We3TVXnnQQ
# Or copy-paste a share link directly
gdown 'https://drive.google.com/file/d/0B9P1L--7Wd2vU3VUVlFnbTgtS2c/view?usp=sharing'
Usage
CLI
Files
# Download by URL
gdown https://drive.google.com/uc?id=1l_5RK28JRL19wpT22B-DY9We3TVXnnQQ
# Download by file ID
gdown 1l_5RK28JRL19wpT22B-DY9We3TVXnnQQ
# Download from a share link
gdown 'https://drive.google.com/file/d/0B9P1L--7Wd2vU3VUVlFnbTgtS2c/view?usp=sharing'
# Save to a specific path
gdown https://drive.google.com/uc?id=0B9P1L--7Wd2vU3VUVlFnbTgtS2c -O /tmp/spam.txt
Folders
# Download an entire folder
gdown https://drive.google.com/drive/folders/15uNXeRBIhVvZJIhL4yTw4IsStMhUaaxl -O /tmp/folder --folder
Google Docs, Sheets, Slides
# Download a Google Slides file (default: pptx)
gdown "https://docs.google.com/presentation/d/15umvZKlsJ3094HNg5S4vJsIhxcFlyTeK/edit?usp=sharing"
# Export as PDF instead
gdown "https://docs.google.com/presentation/d/15umvZKlsJ3094HNg5S4vJsIhxcFlyTeK/edit" --format pdf
Default export formats: Docs → docx, Sheets → xlsx, Slides → pptx.
Resume, speed limit, proxy
# Resume a partially downloaded file
gdown https://drive.google.com/uc?id=1l_5RK28JRL19wpT22B-DY9We3TVXnnQQ --continue
# Limit download speed
gdown https://drive.google.com/uc?id=1l_5RK28JRL19wpT22B-DY9We3TVXnnQQ --speed 10MB
# Download via proxy
gdown https://drive.google.com/uc?id=1l_5RK28JRL19wpT22B-DY9We3TVXnnQQ --proxy http://proxy:8080
Other options
# Skip TLS certificate verification
gdown https://drive.google.com/uc?id=1l_5RK28JRL19wpT22B-DY9We3TVXnnQQ --no-check-certificate
# Don't use cookies from ~/.cache/gdown/cookies.txt
gdown https://drive.google.com/uc?id=1l_5RK28JRL19wpT22B-DY9We3TVXnnQQ --no-cookies
# Use a custom User-Agent
gdown https://drive.google.com/uc?id=1l_5RK28JRL19wpT22B-DY9We3TVXnnQQ --user-agent "MyApp/1.0"
Pipe to stdout
gdown https://github.com/wkentaro/gdown/archive/refs/tags/v4.0.0.tar.gz -O - --quiet | tar zxvf -
Any URL
gdown also works with regular URLs, not just Google Drive:
gdown https://httpbin.org/ip -O ip.json
[!NOTE] For Google Drive URLs, gdown automatically extracts the file ID and downloads the actual file. Use curl or wget to download the raw HTML page instead.
Python
import gdown
# Download a file
url = "https://drive.google.com/uc?id=1l_5RK28JRL19wpT22B-DY9We3TVXnnQQ"
gdown.download(url=url, output="fcn8s_from_caffe.npz")
# Download by file ID
gdown.download(id="0B9P1L--7Wd2vNm9zMTJWOGxobkU", output="output.npz")
# Download from a share link
url = "https://drive.google.com/file/d/0B9P1L--7Wd2vNm9zMTJWOGxobkU/view?usp=sharing"
gdown.download(url=url, output="output.npz")
# Download with hash verification and caching
gdown.cached_download(
url=url,
path="output.npz",
hash="md5:fa837a88f0c40c513d975104edf3da17",
postprocess=gdown.extractall,
)
# Track download progress
def on_progress(bytes_so_far: int, bytes_total: int | None) -> None:
if bytes_total is not None:
print(f"\r{bytes_so_far / bytes_total * 100:.1f}%", end="")
gdown.download(url=url, output="output.npz", quiet=True, progress=on_progress)
# Download a folder
url = "https://drive.google.com/drive/folders/15uNXeRBIhVvZJIhL4yTw4IsStMhUaaxl"
gdown.download_folder(url=url)
# Download a folder by ID
gdown.download_folder(id="15uNXeRBIhVvZJIhL4yTw4IsStMhUaaxl")
FAQ
"Permission Denied" error
Make sure the file sharing is set to "Anyone with the link".
Download still fails even with "Anyone with the link"
Google throttles downloads when too many people access the same file. If you can still open the file in your browser, try exporting cookies:
- Install a browser extension like Get cookies.txt LOCALLY
- Export
cookies.txtand move it to~/.cache/gdown/cookies.txt - Run the download again
Once the file is in place, gdown loads it automatically (no extra flags needed).
Download stops after ~1 hour
Google Drive terminates connections after approximately 1 hour for large files.
Use --continue to resume, and retry until the download completes:
gdown --continue https://drive.google.com/uc?id=<file_id>
Can I use gdown for non-Google-Drive URLs?
Yes. It works with any public HTTP/HTTPS URL.
Contributing
git clone https://github.com/wkentaro/gdown.git
cd gdown
make setup # install dependencies
make test # run tests
make lint # run linters
License
MIT (LICENSE)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gdown-6.0.0rc1.tar.gz.
File metadata
- Download URL: gdown-6.0.0rc1.tar.gz
- Upload date:
- Size: 262.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7dfc2b45ffda9ce1fc1513de3ec2aa816704c22a83b1a69a2528e0cc9763bb7
|
|
| MD5 |
fe37ed8c93f61982d2498d7246758084
|
|
| BLAKE2b-256 |
3b9d5e12c77bf7e91ebdde956daace5c7ffa5c4dec5c74c9b5f6f6baf9007d1e
|
Provenance
The following attestation bundles were made for gdown-6.0.0rc1.tar.gz:
Publisher:
publish.yml on wkentaro/gdown
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gdown-6.0.0rc1.tar.gz -
Subject digest:
a7dfc2b45ffda9ce1fc1513de3ec2aa816704c22a83b1a69a2528e0cc9763bb7 - Sigstore transparency entry: 1280524241
- Sigstore integration time:
-
Permalink:
wkentaro/gdown@bff6f0d9509bd45b4779d984840f80f9c99b5da9 -
Branch / Tag:
refs/tags/v6.0.0rc1 - Owner: https://github.com/wkentaro
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bff6f0d9509bd45b4779d984840f80f9c99b5da9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file gdown-6.0.0rc1-py3-none-any.whl.
File metadata
- Download URL: gdown-6.0.0rc1-py3-none-any.whl
- Upload date:
- Size: 18.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0fcd99d9e4344c92df1fe889fe06ca69d1aed2d8cd8944fa190180986cde50a
|
|
| MD5 |
4de19d59c4080ab181b58e0d1b215f8d
|
|
| BLAKE2b-256 |
c2cf93d7429026deea035f74395fb6b29fb39fb5df6110e27a3cf706989bffd0
|
Provenance
The following attestation bundles were made for gdown-6.0.0rc1-py3-none-any.whl:
Publisher:
publish.yml on wkentaro/gdown
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gdown-6.0.0rc1-py3-none-any.whl -
Subject digest:
d0fcd99d9e4344c92df1fe889fe06ca69d1aed2d8cd8944fa190180986cde50a - Sigstore transparency entry: 1280524254
- Sigstore integration time:
-
Permalink:
wkentaro/gdown@bff6f0d9509bd45b4779d984840f80f9c99b5da9 -
Branch / Tag:
refs/tags/v6.0.0rc1 - Owner: https://github.com/wkentaro
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bff6f0d9509bd45b4779d984840f80f9c99b5da9 -
Trigger Event:
push
-
Statement type: