Cross-platform Google Drive file uploader and downloader CLI
Project description
EH Google Drive Uploader
Cross-platform Python CLI tool to upload and download files to/from 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
- Download files by ID
- Search files by name
- 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
# Download
eh-gdrive-uploader -d FILE_ID
eh-gdrive-uploader -d FILE_ID -o ./downloads/
# List files
eh-gdrive-uploader --list # or -l
# Search files
eh-gdrive-uploader --search "doc" # or -s
# Version info
eh-gdrive-uploader --version # or -v
# 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)
- Go to Google Cloud Console
- Create new project (top-left dropdown)
- Enable Google Drive API:
- Navigation menu → APIs & Services → Library
- Search "Google Drive API" → Click Enable
- Create OAuth Credentials:
- APIs & Services → Credentials
- Click Create Credentials → OAuth client ID
- Application type: Desktop application
- Name:
Drive Uploader - Click Create → Download JSON
- 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
- Copy downloaded file to:
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:
- Go to Google Cloud Console
- Select your project → APIs & Services → OAuth consent screen
- Under Test users, click Add users
- Add your Gmail address (
YOUREMAIL@gmail.com) - 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
Download from Google Drive
# Download file by ID (saves to current directory with original name)
eh-gdrive-uploader -d FILE_ID
# Download to specific directory (creates if doesn't exist)
eh-gdrive-uploader -d FILE_ID -o ./downloads/
# Download with new name
eh-gdrive-uploader -d FILE_ID -o myfile.zip
# Get file ID from list or URL (https://drive.google.com/file/d/FILE_ID/view)
Note: Google Docs, Sheets, and Slides are automatically exported to Microsoft Office formats (.docx, .xlsx, .pptx).
Search Files
# Search files by name
eh-gdrive-uploader --search "report"
# Search with partial match
eh-gdrive-uploader -s "backup"
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.jsonortoken.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
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 eh_gdrive_uploader-1.1.1.tar.gz.
File metadata
- Download URL: eh_gdrive_uploader-1.1.1.tar.gz
- Upload date:
- Size: 12.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29e0b5107cd48caafeaa50bd2e79c3d2279a4ca7b92239bd0aaaf3b1d8993752
|
|
| MD5 |
190c3d8ab0c4bfe50050cf1f69533289
|
|
| BLAKE2b-256 |
a91670e159157816b87e63c17e5982cb2c5a06ec990439dea2ced019b6f30707
|
File details
Details for the file eh_gdrive_uploader-1.1.1-py3-none-any.whl.
File metadata
- Download URL: eh_gdrive_uploader-1.1.1-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24df006591e9e560c3e5b7522926c4d2cb67025ceddf7e4426aa83eafa51c061
|
|
| MD5 |
db6ad4fbf3141b53c779d1079fc3126b
|
|
| BLAKE2b-256 |
72b14f73d6e31adec52528c85416160caf521d2316c6bc3a4bbfd330632564a0
|