Skip to main content

Cross-platform Google Drive file uploader CLI

Project description

EH Google Drive Uploader

PyPI version Python 3.8+ License: MIT

Cross-platform Python CLI tool to upload files to Google Drive.

By Esmail Ebrahim Hamza (@EsmailEbrahim)

Features

  • Upload any file type (including large ZIP archives)
  • OAuth2 secure authentication (browser login once, reuse token)
  • Upload to specific Drive folders
  • Rename files on upload
  • Cross-platform: Windows, Linux, macOS
  • Resumable uploads for reliability

Installation

From PyPI (Recommended)

pip install eh-gdrive-uploader
eh-gdrive-uploader --version

From Source

git clone https://github.com/EsmailEbrahim/eh-gdrive-uploader.git
cd eh-gdrive-uploader
pip install -e .

Usage

# Upload file
eh-gdrive-uploader myfile.zip

# Upload to folder
eh-gdrive-uploader myfile.zip -f FOLDER_ID

# Rename
eh-gdrive-uploader myfile.zip -n newname.zip

# List files
eh-gdrive-uploader --list

# Setup help
eh-gdrive-uploader --setup

Quick Start

1. Clone & Setup Environment

From Source (Development)

# Clone repo
git clone https://github.com/EsmailEbrahim/eh-gdrive-uploader.git
cd eh-gdrive-uploader

# Create virtual environment
python -m venv venv

# Activate (Windows)
venv\Scripts\activate
# Activate (Linux/macOS)
# source venv/bin/activate

# Install in editable mode
pip install -e .

# Verify installation
eh-gdrive-uploader --version

2. Google Cloud Setup (One-time)

  1. Go to Google Cloud Console
  2. Create new project (top-left dropdown)
  3. Enable Google Drive API:
    • Navigation menu → APIs & Services → Library
    • Search "Google Drive API" → Click Enable
  4. Create OAuth Credentials:
    • APIs & Services → Credentials
    • Click Create Credentials → OAuth client ID
    • Application type: Desktop application
    • Name: Drive Uploader
    • Click CreateDownload JSON
  5. Place credentials:
    • Copy downloaded file to: ~/.gdrive_uploader/credentials.json
    • Windows: C:\Users\YOURNAME\.gdrive_uploader\credentials.json
    • Ubuntu: /home/YOURNAME/.gdrive_uploader/credentials.json

Or run: python -m eh_gdrive_uploader.gdrive_upload --setup for detailed instructions.

3. First Run (Authentication)

python -m eh_gdrive_uploader.gdrive_upload myfile.zip

Browser will open for Google login → Authorization token saved automatically.


Error: "Access blocked: Test has not completed the Google verification process"

Solution:

  1. Go to Google Cloud Console
  2. Select your project → APIs & ServicesOAuth consent screen
  3. Under Test users, click Add users
  4. Add your Gmail address (YOUREMAIL@gmail.com)
  5. Save and retry the script

Usage

Basic Upload

# Upload to Drive root
python -m eh_gdrive_uploader.gdrive_upload backup.zip

# Upload with progress
python -m eh_gdrive_uploader.gdrive_upload "C:\Users\Me\Documents\archive.zip"

Upload to Specific Folder

# Get folder ID from Drive URL (last part after /folders/)
python -m eh_gdrive_uploader.gdrive_upload backup.zip -f 1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms

Rename on Upload

python -m eh_gdrive_uploader.gdrive_upload backup.zip -n "backup-2026-02-05.zip"

List Recent Files

python -m eh_gdrive_uploader.gdrive_upload --list

Show Setup Help

python -m eh_gdrive_uploader.gdrive_upload --setup

Environment Management

Activate environment (Windows):

venv\Scripts\activate

Activate environment (Ubuntu/Linux):

source venv/bin/activate

Deactivate (any platform):

deactivate

Project Structure

eh-gdrive-uploader/
├── eh_gdrive_uploader/   # Main package
│   ├── __init__.py       # Package initializer
│   └── gdrive_upload.py  # Main script (CLI entry point)
├── venv/                 # Virtual environment (not in git)
├── .gitignore            # Ignore credentials & cache
├── CHANGELOG.md          # Project changelog
├── LICENSE               # Licens file (MIT)
├── Makefile              # Make commands for setup
├── pyproject.toml        # Python project metadata
├── README.md             # This file
├── requirements.txt      # Python dependencies
└── requirements-dev.txt  # Development dependencies

Version History

See CHANGELOG.md for details.

Security Notes

  • Never commit credentials.json or token.pickle — they are in .gitignore
  • Tokens stored locally in ~/.gdrive_uploader/ (user home directory)
  • First run requires browser authentication; subsequent runs use saved token

Troubleshooting

Issue Solution
credentials.json not found Run setup step 2, check file is in ~/.gdrive_uploader/
Browser doesn't open Check default browser; use same machine with GUI
ModuleNotFoundError Run pip install -r requirements.txt inside venv
Token expired Delete ~/.gdrive_uploader/token.pickle and re-run

Author

Esmail Ebrahim Hamza

License

MIT License - Free for personal and commercial use. See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eh_gdrive_uploader-1.0.0.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

eh_gdrive_uploader-1.0.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file eh_gdrive_uploader-1.0.0.tar.gz.

File metadata

  • Download URL: eh_gdrive_uploader-1.0.0.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for eh_gdrive_uploader-1.0.0.tar.gz
Algorithm Hash digest
SHA256 bd1cef792309562a6b296850b2f0724519f68468ef4beff2e63ac6ef3a996530
MD5 84444571b885479844554267d4e53db8
BLAKE2b-256 ff60bffd9f9504fa82cfff77d41bf81888429554bf17707afc19fcad1def2b07

See more details on using hashes here.

File details

Details for the file eh_gdrive_uploader-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for eh_gdrive_uploader-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a89e89c13a9fa18bc83d1266825f2998a550dfff2f644cd1defd8e4335251e97
MD5 afc23b33c19d6bd8954183e5b95293c8
BLAKE2b-256 39687eae7a512fa88fd8e8dbd4c459fab532b1a2a4f2f0d209aff8c8b3340cd5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page