Google Workspace

Google Workspace CLI

Drive · Gmail · Calendar · Sheets · Docs · Chat — six APIs, one install, structured JSON for AI Agents.

✓ 32 tests passed  ·  6 services
Inspired by googleworkspace/cli ★20.5k
Install
$ pip install cli-anything-gworkspace
$ pip install "cli-anything-gworkspace[full]" # includes google-api-python-client
DriveGoogle Drive
gworkspace-cli drive list --limit 20 gworkspace-cli drive upload report.pdf --folder ID gworkspace-cli drive download FILE_ID -o local.pdf gworkspace-cli drive share FILE_ID --email user@co gworkspace-cli drive mkdir "Q1 Reports"

List, upload, download, share, delete files and create folders via Drive API v3. Multipart upload support.

GmailGmail
gworkspace-cli gmail send --to [email protected] -s "Hi" -b "Body" gworkspace-cli gmail list --label INBOX --limit 10 gworkspace-cli gmail search "from:boss has:attachment" gworkspace-cli gmail reply MESSAGE_ID -b "Thanks!" gworkspace-cli gmail labels

Send, list, get, search, reply to and trash emails. Manage labels. Follows the +send +reply +triage pattern from gws reference.

CalendarGoogle Calendar
gworkspace-cli calendar events --days 7 gworkspace-cli calendar create -t "Sprint Review" \   --start 2026-03-20T10:00:00 --end ...T11:00:00 gworkspace-cli calendar calendars gworkspace-cli calendar delete EVENT_ID --yes

Agenda view, event CRUD, multi-calendar support, attendee management via Calendar API v3. Timezone aware.

SheetsGoogle Sheets
gworkspace-cli sheets read SHEET_ID "Sheet1!A1:D10" gworkspace-cli sheets write SHEET_ID "A1" -v '[["x","y"]]' gworkspace-cli sheets append SHEET_ID "A1" -v '["Alice",95]' gworkspace-cli sheets create -t "Q1 Budget" gworkspace-cli sheets info SHEET_ID

Read/write/append cell ranges, create spreadsheets — Sheets API v4. Ideal for data pipeline automation and reporting.

DocsGoogle Docs
gworkspace-cli docs create -t "Report" -c "Content..." gworkspace-cli docs get DOC_ID --text-only gworkspace-cli docs append DOC_ID "New paragraph" gworkspace-cli docs info DOC_ID

Create docs, extract plain text, append content, get metadata — Docs API v1. Great for automated report generation.

ChatGoogle Chat
gworkspace-cli chat spaces gworkspace-cli chat send spaces/XYZ "Deploy done ✓" gworkspace-cli chat messages spaces/XYZ --limit 20

List spaces, send and read messages — Chat API v1. Build internal notification bots for CI/CD, alerts and reports.

Authentication
1. Access Token (fastest)
Pre-obtained token (from gcloud, OAuth flow, etc.).

export GOOGLE_WORKSPACE_TOKEN=$(gcloud auth print-access-token)
or: gworkspace-cli --token TOKEN drive list
2. Service Account (server/CI)
JSON key file from GCP Console. Best for automation.

export GOOGLE_APPLICATION_CREDENTIALS=/path/sa.json
Requires pip install google-auth
3. OAuth2 User (desktop)
OAuth2 user credentials file from GCP Console.

export GWS_OAUTH_FILE=~/.config/gws/credentials.json
See: googleworkspace/cli auth guide
Full Command Reference
CommandArgumentsDescription
── DRIVE ──
drive list--limit N --query Q --folder IDList files
drive infoFILE_IDGet file metadata
drive uploadFILEPATH --name N --folder IDUpload file (multipart)
drive downloadFILE_ID -o PATHDownload file
drive shareFILE_ID --email E --role reader|writerShare file or make public
drive deleteFILE_ID --yesMove to trash
drive mkdirNAME --parent IDCreate folder
── GMAIL ──
gmail send--to E --subject S --body BSend email
gmail list--limit N --label L --query QList emails
gmail getMESSAGE_ID --format full|metadataGet email details
gmail searchQUERY --limit NSearch (Gmail syntax)
gmail replyMESSAGE_ID --body BReply to email
gmail trashMESSAGE_IDMove to trash
gmail labelsList labels
── CALENDAR ──
calendar events--days N --limit N --calendar-id IDUpcoming events (agenda)
calendar create-t TITLE --start DT --end DT --attendees E,ECreate event
calendar getEVENT_IDGet event details
calendar deleteEVENT_ID --yesDelete event
calendar calendarsList calendars
── SHEETS ──
sheets readSPREADSHEET_ID "Sheet1!A1:D10"Read cell range
sheets writeSHEET_ID RANGE -v '[["a","b"]]'Write values (overwrite)
sheets appendSHEET_ID RANGE -v '["val1","val2"]'Append row(s)
sheets create-t TITLE --sheets "Sheet1,Sheet2"Create spreadsheet
sheets infoSPREADSHEET_IDGet metadata
── DOCS ──
docs create-t TITLE -c "Initial content"Create document
docs getDOC_ID --text-onlyGet doc / extract text
docs appendDOC_ID "New paragraph text"Append to end
docs infoDOC_IDGet metadata
── CHAT ──
chat spaces--limit NList spaces
chat sendSPACE_NAME "Message text"Send message
chat messagesSPACE_NAME --limit NList space messages
Agent Integration Example
# Install
pip install cli-anything-gworkspace

# Discover capabilities (no credentials needed)
gworkspace-cli schema

# Set credentials (choose one)
export GOOGLE_WORKSPACE_TOKEN=$(gcloud auth print-access-token)
# or
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/sa.json

# Health check
gworkspace-cli --json detect
# → {"status":"ok","email":"[email protected]","services":["drive","gmail","calendar","sheets","docs","chat"]}

# Drive: list recent files
gworkspace-cli --json drive list --limit 5

# Gmail: send a notification
gworkspace-cli --json gmail send --to [email protected] -s "Deploy complete" -b "v2.0.1 is live"

# Calendar: today's agenda
gworkspace-cli --json calendar events --days 1

# Sheets: append a row
gworkspace-cli --json sheets append SHEET_ID "A1" -v '["2026-03-15","passed","42ms"]'

# Docs: create report
gworkspace-cli --json docs create -t "Weekly Report" -c "Summary: all tests passing"

# Chat: notify team
gworkspace-cli --json chat send spaces/AAAA "Pipeline finished. 42 tests passed."