@tjboudreaux/gdcli
v0.2.1
Published
Google Drive, Docs, Sheets, Slides CLI
Maintainers
Readme
gdcli

Minimal CLI for Google Drive, Docs, Sheets, and Slides.
Install
npm install -g @tjboudreaux/gdcliSetup
Before using gdcli, you need OAuth2 credentials from Google Cloud Console:
- Create a new project (or select existing)
- Enable the following APIs:
- Set app name in OAuth branding
- Add test users (all Google accounts you want to use)
- Create OAuth client:
- Click "Create Client"
- Application type: "Desktop app"
- Download the JSON file
Then configure gdcli:
gdcli accounts credentials ~/path/to/credentials.json
gdcli accounts add [email protected]Usage
gdcli accounts <action> Account management
gdcli <email> drive <command> [options] Google Drive operations
gdcli <email> docs <command> [options] Google Docs operations
gdcli <email> sheets <command> [options] Google Sheets operations
gdcli <email> slides <command> [options] Google Slides operationsCommands
accounts
gdcli accounts credentials <file.json> # Set OAuth credentials (once)
gdcli accounts list # List configured accounts
gdcli accounts add <email> # Add account (opens browser)
gdcli accounts add <email> --manual # Add account (browserless, paste redirect URL)
gdcli accounts remove <email> # Remove accountdrive
# List and search
gdcli <email> drive list [--query Q] [--max N] [--type TYPE]
gdcli <email> drive search <query>
# File operations
gdcli <email> drive get <fileId>
gdcli <email> drive download <fileId> [--out PATH]
gdcli <email> drive upload <file> [--parent ID] [--name NAME]
gdcli <email> drive delete <fileId>
gdcli <email> drive move <fileId> --to <folderId>
gdcli <email> drive copy <fileId> [--name NAME]
# Folder operations
gdcli <email> drive mkdir <name> [--parent ID]
# Sharing
gdcli <email> drive share <fileId> --email <email> --role <reader|writer>
gdcli <email> drive permissions <fileId>
# URLs
gdcli <email> drive url <fileIds...>Type filter options: document, spreadsheet, presentation, folder, pdf
Query syntax examples:
name contains 'report'mimeType = 'application/pdf'modifiedTime > '2024-01-01''folderId' in parents
docs
gdcli <email> docs get <documentId> [--format text|md|json]
gdcli <email> docs create <title>
gdcli <email> docs append <documentId> --text <text>
gdcli <email> docs replace <documentId> --find <text> --replace <text>
gdcli <email> docs url <documentIds...>sheets
gdcli <email> sheets get <spreadsheetId>
gdcli <email> sheets read <spreadsheetId> <range>
gdcli <email> sheets create <title>
gdcli <email> sheets write <spreadsheetId> <range> --values <csv>
gdcli <email> sheets append <spreadsheetId> <range> --values <csv>
gdcli <email> sheets clear <spreadsheetId> <range>
gdcli <email> sheets add-sheet <spreadsheetId> <name>
gdcli <email> sheets url <spreadsheetIds...>Range notation (A1):
Sheet1!A1:B10- Specific rangeSheet1!A:A- Entire columnSheet1- Entire sheet
slides
gdcli <email> slides get <presentationId>
gdcli <email> slides create <title>
gdcli <email> slides add-slide <presentationId> [--layout LAYOUT]
gdcli <email> slides delete-slide <presentationId> <pageId>
gdcli <email> slides replace <presentationId> --find <text> --replace <text>
gdcli <email> slides thumbnail <presentationId> <pageId> [--out PATH]
gdcli <email> slides url <presentationIds...>Layout options: BLANK, TITLE, TITLE_AND_BODY, TITLE_AND_TWO_COLUMNS, TITLE_ONLY, SECTION_HEADER
Examples
# List all documents
gdcli [email protected] drive list --type document
# Search for files
gdcli [email protected] drive search "name contains 'Q4 Report'"
# Download a file
gdcli [email protected] drive download 1abc123xyz --out ./report.pdf
# Upload a file to a folder
gdcli [email protected] drive upload ./data.csv --parent 1folderid123
# Get document as markdown
gdcli [email protected] docs get 1docid123 --format md
# Read spreadsheet range
gdcli [email protected] sheets read 1sheetid123 "Sheet1!A1:D10"
# Write to spreadsheet
gdcli [email protected] sheets write 1sheetid123 "A1:B2" --values "Name,Age
Alice,30"
# Create a presentation
gdcli [email protected] slides create "Q4 Review"
# Add a slide
gdcli [email protected] slides add-slide 1presid123 --layout TITLE_AND_BODYData Storage
All data is stored in ~/.gdcli/:
credentials.json- OAuth client credentialsaccounts.json- Account tokensdownloads/- Downloaded files
Development
npm install
npm run build
npm run check
npm testAcknowledgements
Inspired by:
License
MIT
