📦 gdrive-zip
Download an entire Google Drive folder as a single ZIP file.
No more 2 GB split archives. No browser needed after setup.
Why?
When you click "Download" on a Google Drive folder, Drive splits large folders into multiple ~2 GB ZIP files. You then have to download each one, extract them separately, and reassemble — tedious and error-prone.
gdrive-zip talks directly to the Drive API, downloads every file itself, and writes a single ZIP archive (zip64-enabled, no size cap). One command. One file.
Features
| Feature | Details |
|---|---|
| ✅ Single ZIP output | No 2 GB split — zip64 handles folders of any size |
| ✅ Recursive folders | Preserves the full nested folder structure inside the ZIP |
| ✅ Google Docs export | Docs → .docx, Sheets → .xlsx, Slides → .pptx, Drawings → .png |
| ✅ Shared folders | Works for "anyone with the link" and "Shared with me" |
| ✅ Progress bars | Real-time per-file download progress via tqdm |
✅ --no-zip mode |
Extract directly to a local folder instead |
| ✅ Cached auth | Logs in once; stores a local token for future runs |
Quick Start
1. Install
pip install gdrive-zip
Or run directly from source:
git clone https://github.com/SanjayKumar301/gdrive-zip.git cd gdrive-zip pip install -e .
2. One-Time Setup (~5 minutes)
gdrive-zip uses the Google Drive API, which requires a free OAuth2 credential from your Google Cloud account. You only do this once.
▶ Click to expand setup instructions
Step 1 — Create a Google Cloud project
- Go to console.cloud.google.com
- Click "New Project" → give it any name (e.g.
gdrive-zip) → Create
Step 2 — Enable the Drive API
- In the top search bar, type "Google Drive API" → click it
- Click "Enable"
Step 3 — Configure the OAuth consent screen
- Go to APIs & Services → OAuth consent screen
- Choose "External" user type → Create
- Fill in:
- App name:
gdrive-zip(or anything) - User support email: your Gmail address
- Developer contact email: your Gmail address
- App name:
- Click Save and Continue through all steps (you can leave optional fields blank)
- On the "Test users" page, click "+ Add users" and add your own Gmail address
Step 4 — Create OAuth credentials
- Go to APIs & Services → Credentials → + Create Credentials → OAuth client ID
- Application type: "Desktop app"
- Name: anything (e.g.
gdrive-zip-client) - Click "Create"
Step 5 — Save your credentials
Once you download your client secret JSON from Google Cloud:
Option A (Recommended for pip users): Run this one command to auto-save it globally:
gdrive-zip --set-credentials ~/Downloads/credentials.json
(This automatically copies it to ~/.gdrive-zip/credentials.json on Linux/macOS or C:\Users\<you>\.gdrive-zip\credentials.json on Windows.)
Option B (Manual copy):
Place credentials.json directly into your global config folder:
- Windows:
C:\Users\<username>\.gdrive-zip\credentials.json - macOS / Linux:
~/.gdrive-zip/credentials.json
(Run gdrive-zip --config-dir anytime to verify your configuration status!)
Option C (Per-project / Git clone):
Place credentials.json in your current working directory or the cloned repo folder.
3. Run
# Download a shared folder (paste the URL directly)
gdrive-zip https://drive.google.com/drive/folders/1AbCDeFGhIJkLmNoPQRsTuVwXyZ
# Specify a custom output filename
gdrive-zip https://drive.google.com/drive/folders/1AbCDe... my_archive.zip
# Use a raw folder ID instead of a URL
gdrive-zip 1AbCDeFGhIJkLmNoPQRsTuVwXyZ
# Pass a custom credentials file on the fly
gdrive-zip <FOLDER_URL> --credentials /path/to/credentials.json
# Download to a directory instead of a ZIP
gdrive-zip https://drive.google.com/drive/folders/1AbCDe... --no-zip
# Check configuration directory & status
gdrive-zip --config-dir
# Check the version
gdrive-zip --version
The first time you run it, a browser window will open asking you to sign in to Google and approve read-only Drive access. After that, authentication is cached in your global config (~/.gdrive-zip/token.json) — you won't be prompted again.
Usage Reference
usage: gdrive-zip [-h] [--credentials PATH] [--set-credentials PATH]
[--config-dir] [--no-zip] [--version]
[FOLDER] [output]
positional arguments:
FOLDER Google Drive folder URL or bare folder ID
output Output filename (default: drive_download.zip) or
output directory when --no-zip is used (default:
drive_download)
options:
-h, --help show this help message and exit
--credentials PATH Explicit path to credentials.json
--set-credentials PATH
Copy credentials.json into ~/.gdrive-zip/ for global
use
--config-dir Show the ~/.gdrive-zip/ config directory path and
status
--no-zip Download files to a local directory instead of
creating a ZIP archive
--version show program's version number and exit
How It Works
gdrive-zip <folder_url>
│
├─ OAuth2 login (browser, one-time only)
│
├─ Drive API: recursively list all files & subfolders
│
├─ For each file:
│ ├─ Regular files → get_media()
│ └─ Google Docs/Sheets/Slides → export_media() → .docx/.xlsx/.pptx
│
└─ Write everything into a single ZIP (zip64, no size cap)
File Structure (after cloning)
gdrive-zip/
├── drive_folder_downloader.py # Main script / entry point
├── credentials.example.json # Template — copy to credentials.json
├── requirements.txt
├── pyproject.toml
├── LICENSE
└── README.md
Note:
credentials.jsonandtoken.jsonare excluded from git via.gitignore. They are never committed.
Supported Google-Native Types
| Google Type | Exported As |
|---|---|
| Google Docs | .docx (Word) |
| Google Sheets | .xlsx (Excel) |
| Google Slides | .pptx (PowerPoint) |
| Google Drawings | .png |
| Forms, Sites, etc. | ⚠️ Skipped (no export format) |
Requirements
- Python 3.8+
- A free Google Cloud project with the Drive API enabled
credentials.json(see One-Time Setup)
Dependencies (installed automatically via pip):
google-auth
google-auth-oauthlib
google-api-python-client
tqdm
Troubleshooting
| Problem | Fix |
|---|---|
credentials.json not found |
Complete the One-Time Setup and place the file next to the script |
403 Access Denied |
Make sure you added your Gmail to the "Test users" list in the OAuth consent screen |
404 File not found |
The folder ID in the URL may be wrong, or the folder isn't shared with your account |
| Browser doesn't open | Run on a machine with a browser; or set up a service account for headless use |
| Google Docs skipped | Export limit exceeded (very large Docs files); retry or open and re-save in Drive |
Contributing
Pull requests are welcome! Please:
- Fork the repo
- Create a feature branch:
git checkout -b feature/my-feature - Commit your changes:
git commit -m "Add my feature" - Push and open a PR
For major changes, open an issue first to discuss what you'd like to change.
License
MIT — see LICENSE.
Made with ☕ · Report a bug
Metadata
Release files for gdrive-zip 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gdrive_zip-1.0.1.tar.gz | 10.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gdrive_zip-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.2 kB
Release files / gdrive_zip-1.0.1.tar.gz
| Download URL | gdrive_zip-1.0.1.tar.gz |
|---|---|
| Size | 10.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9f2524119aca7564a28420f11111e05d2529c54692721142530447445ef5dfa1
|
|
BLAKE2b-256 checksum How to use checksums |
3b412744ed419838a4a4025e0e98121c252412573c8a542a8fdb45dcd9d32c22
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.6
|
Release files / gdrive_zip-1.0.1-py3-none-any.whl
| Download URL | gdrive_zip-1.0.1-py3-none-any.whl |
|---|---|
| Size | 11.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8a24b8f3eb8daaf06d5e061f583348d1d4885ec7c604c5e0ec887c12d2c16935
|
|
BLAKE2b-256 checksum How to use checksums |
da0638b4b209cd932d88b1716db83193e7c4a9cc2db47f88535977e757ecd466
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.6
|