Skip to main content

📦 gdrive-zip

Download an entire Google Drive folder as a single ZIP file.

No more 2 GB split archives. No browser needed after setup.

Python License: MIT PyPI


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

  1. Go to console.cloud.google.com
  2. Click "New Project" → give it any name (e.g. gdrive-zip) → Create

Step 2 — Enable the Drive API

  1. In the top search bar, type "Google Drive API" → click it
  2. Click "Enable"
  1. Go to APIs & Services → OAuth consent screen
  2. Choose "External" user type → Create
  3. Fill in:
    • App name: gdrive-zip (or anything)
    • User support email: your Gmail address
    • Developer contact email: your Gmail address
  4. Click Save and Continue through all steps (you can leave optional fields blank)
  5. On the "Test users" page, click "+ Add users" and add your own Gmail address

Step 4 — Create OAuth credentials

  1. Go to APIs & Services → Credentials → + Create Credentials → OAuth client ID
  2. Application type: "Desktop app"
  3. Name: anything (e.g. gdrive-zip-client)
  4. Click "Create"

Step 5 — Download and place the credentials file

  1. In the credential list, find the one you just created
  2. Click the download icon (↓) on the right
  3. Rename the downloaded file to credentials.json
  4. Place it in the same directory as the script (or the installed package 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

# Download to a directory instead of a ZIP
gdrive-zip https://drive.google.com/drive/folders/1AbCDe... --no-zip

# 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, a token.json is cached locally — you won't be prompted again.


Usage Reference

usage: gdrive-zip [-h] [--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
  --no-zip    Download files to a local directory instead of creating a ZIP
  --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.json and token.json are 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:

  1. Fork the repo
  2. Create a feature branch: git checkout -b feature/my-feature
  3. Commit your changes: git commit -m "Add my feature"
  4. 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.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gdrive-zip 1.0.0
File Size Uploaded
gdrive_zip-1.0.0.tar.gz 9.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gdrive-zip 1.0.0
File Interpreter ABI Platform
gdrive_zip-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 18.9 kB

Release files / gdrive_zip-1.0.0.tar.gz

Download URL gdrive_zip-1.0.0.tar.gz
Size 9.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c27775586af02207a965475470440ed35c8744f54d505b0346693e92e09bb99d
BLAKE2b-256 checksum
How to use checksums
d2bc04edad14d1c317e28188e6d05358af86b0297c47c851a1d92a470c831817
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.0-py3-none-any.whl

Download URL gdrive_zip-1.0.0-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d4c765c503c9fbfe4c40f694d00e7b031bc31a8ae9a7992a566a0acef805b284
BLAKE2b-256 checksum
How to use checksums
be6d5388b5fd86d707f62e211f22d2d3c63a1b6e59d862d250daaea5a582db21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.6

Release history Release notifications | RSS feed

1.0.1

2 release files

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page