
googleworkspace / cli
✓ Official★ 29,400A skill package that teaches your agent 92 capabilities — every one documented and browsable below, no GitHub required · by Google.
Each skill below is one capability this package teaches your agent. Install the whole package, or open a skill to install just that one.
Google Workspace Admin SDK: Audit logs and usage reports.
1 file — installable on its own
Google Calendar: Manage calendars and events.
1 file — installable on its own
Google Calendar: Show upcoming events across all calendars.
1 file — installable on its own
Google Calendar: Create a new event.
1 file — installable on its own
Google Chat: Manage Chat spaces and messages.
1 file — installable on its own
Google Chat: Send a message to a space.
1 file — installable on its own
Google Classroom: Manage classes, rosters, and coursework.
1 file — installable on its own
Read and write Google Docs.
1 file — installable on its own
Google Docs: Append text to a document.
1 file — installable on its own
Google Drive: Manage files, folders, and shared drives.
1 file — installable on its own
Google Drive: Upload a file with automatic metadata.
1 file — installable on its own
Subscribe to Google Workspace events.
1 file — installable on its own
Google Workspace Events: Renew/reactivate Workspace Events subscriptions.
1 file — installable on its own
Google Workspace Events: Subscribe to Workspace events and stream them as NDJSON.
1 file — installable on its own
Read and write Google Forms.
1 file — installable on its own
Gmail: Send, read, and manage email.
1 file — installable on its own
Gmail: Forward a message to new recipients.
1 file — installable on its own
Gmail: Reply to a message (handles threading automatically).
1 file — installable on its own
Gmail: Reply-all to a message (handles threading automatically).
1 file — installable on its own
Gmail: Send an email.
1 file — installable on its own
Gmail: Show unread inbox summary (sender, subject, date).
1 file — installable on its own
Gmail: Watch for new emails and stream them as NDJSON.
1 file — installable on its own
Manage Google Keep notes.
1 file — installable on its own
Manage Google Meet conferences.
1 file — installable on its own
Google Model Armor: Filter user-generated content for safety.
1 file — installable on its own
Google Model Armor: Create a new Model Armor template.
1 file — installable on its own
Google Model Armor: Sanitize a user prompt through a Model Armor template.
1 file — installable on its own
Google Model Armor: Sanitize a model response through a Model Armor template.
1 file — installable on its own
Google People: Manage contacts and profiles.
1 file — installable on its own
gws CLI: Shared patterns for authentication, global flags, and output formatting.
1 file — installable on its own
Google Sheets: Read and write spreadsheets.
1 file — installable on its own
Google Sheets: Append a row to a spreadsheet.
1 file — installable on its own
Google Sheets: Read values from a spreadsheet.
1 file — installable on its own
Google Slides: Read and write presentations.
1 file — installable on its own
Google Tasks: Manage task lists and tasks.
1 file — installable on its own
Google Workflow: Cross-service productivity workflows.
1 file — installable on its own
Google Workflow: Convert a Gmail message into a Google Tasks entry.
1 file — installable on its own
Google Workflow: Announce a Drive file in a Chat space.
1 file — installable on its own
Google Workflow: Prepare for your next meeting: agenda, attendees, and linked docs.
1 file — installable on its own
Google Workflow: Today's meetings + open tasks as a standup summary.
1 file — installable on its own
Google Workflow: Weekly summary: this week's meetings + unread email count.
1 file — installable on its own
Create, organize, and distribute content across Workspace.
1 file — installable on its own
Manage customer support — track tickets, respond, escalate issues.
1 file — installable on its own
Plan and manage events — scheduling, invitations, and logistics.
1 file — installable on its own
Manage an executive's schedule, inbox, and communications.
1 file — installable on its own
Handle HR workflows — onboarding, announcements, and employee comms.
1 file — installable on its own
Administer IT — manage users, monitor security, configure Workspace.
1 file — installable on its own
Coordinate projects — track tasks, schedule meetings, and share docs.
1 file — installable on its own
Organize research — manage references, notes, and collaboration.
1 file — installable on its own
Manage sales workflows — track deals, schedule calls, client comms.
1 file — installable on its own
Lead a team — run standups, coordinate tasks, and communicate.
1 file — installable on its own
Export a Google Sheets spreadsheet as a CSV file for local backup or processing.
1 file — installable on its own
Add a list of attendees to an existing Google Calendar event and send notifications.
1 file — installable on its own
Create recurring focus time blocks on Google Calendar to protect deep work hours.
1 file — installable on its own
List and download all files from a Google Drive folder.
1 file — installable on its own
Retrieve and review responses from a Google Form.
1 file — installable on its own
Read data from two tabs in a Google Sheet to compare and identify differences.
1 file — installable on its own
Duplicate a Google Sheets template tab for a new month of tracking.
1 file — installable on its own
Create a Google Classroom course and invite students.
1 file — installable on its own
Copy a Google Docs template, fill in content, and share with collaborators.
1 file — installable on its own
Read event data from a Google Sheets spreadsheet and create Google Calendar entries for each row.
1 file — installable on its own
Set up a Google Sheets spreadsheet for tracking expenses with headers and initial entries.
1 file — installable on its own
Create a Google Form for feedback and share it via Gmail.
1 file — installable on its own
Create a Gmail filter to automatically label, star, or categorize incoming messages.
1 file — installable on its own
Create a Google Meet meeting space and share the join link.
1 file — installable on its own
Create a new Google Slides presentation and add initial slides.
1 file — installable on its own
Create a Google Shared Drive and add members with appropriate roles.
1 file — installable on its own
Set up a new Google Tasks list with initial tasks.
1 file — installable on its own
Enable a Gmail out-of-office auto-reply with a custom message and date range.
1 file — installable on its own
Read content from a Google Doc and use it as the body of a Gmail message.
1 file — installable on its own
Share a Google Drive file and email the link with a message to recipients.
1 file — installable on its own
Query Google Calendar free/busy status for multiple users to find a meeting slot.
1 file — installable on its own
Identify large Google Drive files consuming storage quota.
1 file — installable on its own
Find Gmail messages with a specific label and forward them to another address.
1 file — installable on its own
Read data from a Google Sheet and create a formatted Google Docs report.
1 file — installable on its own
Apply Gmail labels to matching messages and archive them to keep your inbox clean.
1 file — installable on its own
Append a deal status update to a Google Sheets sales tracking spreadsheet.
1 file — installable on its own
Create a Google Drive folder structure and move files into the right locations.
1 file — installable on its own
Review your Google Calendar week, identify gaps, and add events to fill them.
1 file — installable on its own
Create a Google Docs post-mortem, schedule a Google Calendar review, and notify via Chat.
1 file — installable on its own
Move a Google Calendar event to a new time and automatically notify all attendees.
1 file — installable on its own
Review who attended a Google Meet conference and for how long.
1 file — installable on its own
Find Google Tasks that are past due and need attention.
1 file — installable on its own
Find Gmail messages with attachments and save them to a Google Drive folder.
1 file — installable on its own
Save a Gmail message body into a Google Doc for archival or reference.
1 file — installable on its own
Create a recurring Google Calendar event with attendees.
1 file — installable on its own
Send a team announcement via both Gmail and a Google Chat space.
1 file — installable on its own
Share a Google Docs document with edit access and email collaborators the link.
1 file — installable on its own
Share Google Drive files with all attendees of a Google Calendar event.
1 file — installable on its own
Share a Google Drive folder and all its contents with a list of collaborators.
1 file — installable on its own
Export Google Contacts directory to a Google Sheets spreadsheet.
1 file — installable on its own
Subscribe to change notifications on a Google Drive file or folder.
1 file — installable on its own
One CLI for all of Google Workspace — built for humans and AI agents.<br> Drive, Gmail, Calendar, and every Workspace API. Zero boilerplate. Structured JSON output. 40+ agent skills included.
<p> <a href="https://www.npmjs.com/package/@googleworkspace/cli"><img src="https://img.shields.io/npm/v/@googleworkspace/cli" alt="npm version"></a> <a href="https://github.com/googleworkspace/cli/blob/main/LICENSE"><img src="https://img.shields.io/github/license/googleworkspace/cli" alt="license"></a> <a href="https://github.com/googleworkspace/cli/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/googleworkspace/cli/ci.yml?branch=main&label=CI" alt="CI status"></a> <a href="https://www.npmjs.com/package/@googleworkspace/cli"><img src="https://img.shields.io/npm/unpacked-size/@googleworkspace/cli" alt="install size"></a> </p> <br>[!NOTE] This is not an officially supported Google product.
⬇️ Download the latest release for your OS
gws doesn't ship a static list of commands. It reads Google's own Discovery Service at runtime and builds its entire command surface dynamically. When Google Workspace adds an API endpoint or method, gws picks it up automatically.
[!IMPORTANT] This project is under active development. Expect breaking changes as we march toward v1.0.
Contents
- Prerequisites
- Installation
- Quick Start
- Why gws?
- Authentication
- AI Agent Skills
- Advanced Usage
- Environment Variables
- Exit Codes
- Architecture
- Troubleshooting
- Development
Prerequisites
- Node.js 18+ — for
npm install(or download a pre-built binary from GitHub Releases) - A Google Cloud project — required for OAuth credentials. You can create one via the Google Cloud Console or with the
gcloudCLI or with thegws auth setupcommand. - A Google account with access to Google Workspace
Installation
The recommended way to install gws is to download the pre-built binary for your OS and architecture from the GitHub Releases page. Extract the archive and place the gws binary in your $PATH.
For convenience, you can also use npm to automate downloading the appropriate binary from GitHub Releases:
npm install -g @googleworkspace/cliOr build from source:
cargo install --git https://github.com/googleworkspace/cli --lockedA Nix flake is also available at github:googleworkspace/cli
nix run github:googleworkspace/cliOn macOS and Linux, you can also install via Homebrew:
brew install googleworkspace-cliQuick Start
gws auth setup # walks you through Google Cloud project config
gws auth login # subsequent OAuth login
gws drive files list --params '{"pageSize": 5}'Why gws?
For humans — stop writing curl calls against REST docs. gws gives you --help on every resource, --dry-run to preview requests, and auto‑pagination.
For AI agents — every response is structured JSON. Pair it with the included agent skills and your LLM can manage Workspace without custom tooling.
# List the 10 most recent files
gws drive files list --params '{"pageSize": 10}'
# Create a spreadsheet
gws sheets spreadsheets create --json '{"properties": {"title": "Q1 Budget"}}'
# Send a Chat message
gws chat spaces messages create \
--params '{"parent": "spaces/xyz"}' \
--json '{"text": "Deploy complete."}' \
--dry-run
# Introspect any method's request/response schema
gws schema drive.files.list
# Stream paginated results as NDJSON
gws drive files list --params '{"pageSize": 100}' --page-all | jq -r '.files[].name'Authentication
The CLI supports multiple auth workflows so it works on your laptop, in CI, and on a server.
Which setup should I use?
| I have… | Use |
|---|---|
gcloud installed and authenticated | gws auth setup (fastest) |
A GCP project but no gcloud | Manual OAuth setup |
| An existing OAuth access token | GOOGLE_WORKSPACE_CLI_TOKEN |
| Existing Credentials | GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE |
Interactive (local desktop)
Credentials are encrypted at rest (AES-256-GCM) with the key stored in your OS keyring (or ~/.config/gws/.encryption_key when GOOGLE_WORKSPACE_CLI_KEYRING_BACKEND=file).
gws auth setup # one-time: creates a Cloud project, enables APIs, logs you in
gws auth login # subsequent scope selection and login
gws auth setuprequires thegcloudCLI. If you don't havegcloud, use the manual setup below instead.
[!WARNING] Scope limits in testing mode: If your OAuth app is unverified (testing mode), Google limits consent to ~25 scopes. The
recommendedscope preset includes 85+ scopes and will fail for unverified apps (especially for@gmail.comaccounts). Choose individual services instead to filter the scope picker:Copy & paste — that's itgws auth login -s drive,gmail,sheets
Manual OAuth setup (Google Cloud Console)
Use this when gws auth setup cannot automate project/client creation, or when you want explicit control.
- Open Google Cloud Console in the target project:
- OAuth consent screen:
https://console.cloud.google.com/apis/credentials/consent?project=<PROJECT_ID> - Credentials:
https://console.cloud.google.com/apis/credentials?project=<PROJECT_ID>
- OAuth consent screen:
- Configure OAuth branding/audience if prompted:
- App type: External (testing mode is fine)
- Add your account under Test users
- Create an OAuth client:
- Type: Desktop app
- Download the client JSON and save it to:
~/.config/gws/client_secret.json
[!IMPORTANT] You must add yourself as a test user. In the OAuth consent screen, click Test users → Add users and enter your Google account email. Without this, login will fail with a generic "Access blocked" error.
Then run:
gws auth loginBrowser-assisted auth (human or agent)
You can complete OAuth either manually or with browser automation.
- Human flow: run
gws auth login, open the printed URL, approve scopes. - Agent-assisted flow: the agent opens the URL, selects account, handles consent prompts, and returns control once the localhost callback succeeds.
If consent shows "Google hasn't verified this app" (testing mode), click Continue. If scope checkboxes appear, select required scopes (or Select all) before continuing.
Headless / CI (export flow)
- Complete interactive auth on a machine with a browser.
- Export credentials:
Copy & paste — that's it
gws auth export --unmasked > credentials.json - On the headless machine:
Copy & paste — that's it
export GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE=/path/to/credentials.json gws drive files list # just works
Service Account (server-to-server)
Point to your key file; no login needed.
export GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE=/path/to/service-account.json
gws drive files listPre-obtained Access Token
Useful when another tool (e.g. gcloud) already mints tokens for your environment.
export GOOGLE_WORKSPACE_CLI_TOKEN=$(gcloud auth print-access-token)Precedence
| Priority | Source | Set via |
|---|---|---|
| 1 | Access token | GOOGLE_WORKSPACE_CLI_TOKEN |
| 2 | Credentials file | GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE |
| 3 | Encrypted credentials | gws auth login |
| 4 | Plaintext credentials | ~/.config/gws/credentials.json |
Environment variables can also live in a .env file.
AI Agent Skills
The repo ships 100+ Agent Skills (SKILL.md files) — one for every supported API, plus higher-level helpers for common workflows and 50 curated recipes for Gmail, Drive, Docs, Calendar, and Sheets. See the full Skills Index for the complete list.
# Install all skills at once
npx skills add https://github.com/googleworkspace/cli
# Or pick only what you need
npx skills add https://github.com/googleworkspace/cli/tree/main/skills/gws-drive
npx skills add https://github.com/googleworkspace/cli/tree/main/skills/gws-gmail# Symlink all skills (stays in sync with repo)
ln -s $(pwd)/skills/gws-* ~/.openclaw/skills/
# Or copy specific skills
cp -r skills/gws-drive skills/gws-gmail ~/.openclaw/skills/The gws-shared skill includes an install block so OpenClaw auto-installs the CLI via npm if gws isn't on PATH.
Gemini CLI Extension
-
Authenticate the CLI first:
Copy & paste — that's itgws auth setup -
Install the extension into the Gemini CLI:
Copy & paste — that's itgemini extensions install https://github.com/googleworkspace/cli
Installing this extension gives your Gemini CLI agent direct access to all gws commands and Google Workspace agent skills. Because gws handles its own authentication securely, you simply need to authenticate your terminal once prior to using the agent, and the extension will automatically inherit your credentials.
Advanced Usage
Multipart Uploads
gws drive files create --json '{"name": "report.pdf"}' --upload ./report.pdfPagination
| Flag | Description | Default |
|---|---|---|
--page-all | Auto-paginate, one JSON line per page (NDJSON) | off |
--page-limit <N> | Max pages to fetch | 10 |
--page-delay <MS> | Delay between pages | 100 ms |
Google Sheets — Shell Escaping
Sheets ranges use ! which bash interprets as history expansion. Always wrap values in single quotes:
# Read cells A1:C10 from "Sheet1"
gws sheets spreadsheets values get \
--params '{"spreadsheetId": "SPREADSHEET_ID", "range": "Sheet1!A1:C10"}'
# Append rows
gws sheets spreadsheets values append \
--params '{"spreadsheetId": "ID", "range": "Sheet1!A1", "valueInputOption": "USER_ENTERED"}' \
--json '{"values": [["Name", "Score"], ["Alice", 95]]}'Helper Commands
Some services ship hand-crafted helper commands alongside the auto-generated Discovery surface. Helper commands are prefixed with + so they are visually distinct and never collide with Discovery-generated method names.
Time-aware helpers (+agenda, +standup-report, +weekly-digest, +meeting-prep) automatically use your Google account timezone (fetched from Calendar Settings API and cached for 24 hours). Override with --timezone/--tz on +agenda, or set the --timezone flag for explicit control.
Run gws <service> --help to see both Discovery methods and helper commands together.
gws gmail --help # shows +send, +reply, +reply-all, +forward, +triage, +watch …
gws calendar --help # shows +insert, +agenda …
gws drive --help # shows +upload …Full helper reference:
| Service | Command | Description |
|---|---|---|
gmail | +send | Send an email |
gmail | +reply | Reply to a message (handles threading automatically) |
gmail | +reply-all | Reply-all to a message |
gmail | +forward | Forward a message to new recipients |
gmail | +triage | Show unread inbox summary (sender, subject, date) |
gmail | +watch | Watch for new emails and stream them as NDJSON |
sheets | +append | Append a row to a spreadsheet |
sheets | +read | Read values from a spreadsheet |
docs | +write | Append text to a document |
chat | +send | Send a message to a space |
drive | +upload | Upload a file with automatic metadata |
calendar | +insert | Create a new event |
calendar | +agenda | Show upcoming events (uses Google account timezone; override with --timezone) |
script | +push | Replace all files in an Apps Script project with local files |
workflow | +standup-report | Today's meetings + open tasks as a standup summary |
workflow | +meeting-prep | Prepare for your next meeting: agenda, attendees, and linked docs |
workflow | +email-to-task | Convert a Gmail message into a Google Tasks entry |
workflow | +weekly-digest | Weekly summary: this week's meetings + unread email count |
workflow | +file-announce | Announce a Drive file in a Chat space |
events | +subscribe | Subscribe to Workspace events and stream them as NDJSON |
events | +renew | Renew/reactivate Workspace Events subscriptions |
modelarmor | +sanitize-prompt | Sanitize a user prompt through a Model Armor template |
modelarmor | +sanitize-response | Sanitize a model response through a Model Armor template |
modelarmor | +create-template | Create a new Model Armor template |
Examples:
# Send an email
gws gmail +send --to alice@example.com --subject "Hello" --body "Hi there"
# Reply to a message
gws gmail +reply --message-id MESSAGE_ID --body "Thanks!"
# Append a row to a spreadsheet
gws sheets +append --spreadsheet SPREADSHEET_ID --values "Alice,95"
# Show today's calendar agenda
gws calendar +agenda
# Upload a file to Drive
gws drive +upload ./report.pdf --name "Q1 Report"
# Morning standup summary
gws workflow +standup-report
# Show today's agenda in a specific timezone
gws calendar +agenda --today --timezone America/New_YorkModel Armor (Response Sanitization)
Integrate Google Cloud Model Armor to scan API responses for prompt injection before they reach your agent.
gws gmail users messages get --params '...' \
--sanitize "projects/P/locations/L/templates/T"| Variable | Description |
|---|---|
GOOGLE_WORKSPACE_CLI_SANITIZE_TEMPLATE | Default Model Armor template |
GOOGLE_WORKSPACE_CLI_SANITIZE_MODE | warn (default) or block |
Environment Variables
All variables are optional. See .env.example for a copy-paste template.
| Variable | Description |
|---|---|
GOOGLE_WORKSPACE_CLI_TOKEN | Pre-obtained OAuth2 access token (highest priority) |
GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE | Path to OAuth credentials JSON (user or service account) |
GOOGLE_WORKSPACE_CLI_CLIENT_ID | OAuth client ID (alternative to client_secret.json) |
GOOGLE_WORKSPACE_CLI_CLIENT_SECRET | OAuth client secret (paired with CLIENT_ID) |
GOOGLE_WORKSPACE_CLI_CONFIG_DIR | Override config directory (default: ~/.config/gws) |
GOOGLE_WORKSPACE_CLI_SANITIZE_TEMPLATE | Default Model Armor template |
GOOGLE_WORKSPACE_CLI_SANITIZE_MODE | warn (default) or block |
GOOGLE_WORKSPACE_CLI_LOG | Log level for stderr (e.g., gws=debug). Off by default. |
GOOGLE_WORKSPACE_CLI_LOG_FILE | Directory for JSON log files with daily rotation. Off by default. |
GOOGLE_WORKSPACE_PROJECT_ID | GCP project ID override for quota/billing and fallback for helper commands |
Environment variables can also be set in a .env file (loaded via dotenvy).
Exit Codes
gws uses structured exit codes so scripts can branch on the failure type without parsing error output.
| Code | Meaning | Example cause |
|---|---|---|
0 | Success | Command completed normally |
1 | API error | Google returned a 4xx/5xx response |
2 | Auth error | Credentials missing, expired, or invalid |
3 | Validation error | Bad arguments, unknown service, invalid flag |
4 | Discovery error | Could not fetch the API schema document |
5 | Internal error | Unexpected failure |
gws drive files list --params '{"fileId": "bad"}'
echo $? # 1 — API error
gws unknown-service files list
echo $? # 3 — validation error (unknown service)Architecture
gws uses a two-phase parsing strategy:
- Read
argv[1]to identify the service (e.g.drive) - Fetch the service's Discovery Document (cached 24 h)
- Build a
clap::Commandtree from the document's resources and methods - Re-parse the remaining arguments
- Authenticate, build the HTTP request, execute
All output — success, errors, download metadata — is structured JSON.
Troubleshooting
"Access blocked" or 403 during login
Your OAuth app is in testing mode and your account is not listed as a test user.
Fix: Open the OAuth consent screen in your GCP project → Test users → Add users → enter your Google account email. Then retry gws auth login.
"Google hasn't verified this app"
Expected when your app is in testing mode. Click Advanced → Go to <app name> (unsafe) to proceed. This is safe for personal use; verification is only required to publish the app to other users.
Too many scopes / consent screen error
Unverified (testing mode) apps are limited to ~25 OAuth scopes. The recommended scope preset includes many scopes and will exceed this limit.
Fix: Select only the scopes you need:
gws auth login --scopes drive,gmail,calendargcloud CLI not found
gws auth setup requires the gcloud CLI to automate project creation. You have three options:
- Install gcloud and use
gclouddirectly. - Re-run
gws auth setupwhich wrapsgcloudcalls. - Skip
gcloudentirely — set up OAuth credentials manually in the Cloud Console
redirect_uri_mismatch
The OAuth client was not created as a Desktop app type. In the Credentials page, delete the existing client, create a new one with type Desktop app, and download the new JSON.
API not enabled — accessNotConfigured
If a required Google API is not enabled for your GCP project, you will see a
403 error with reason accessNotConfigured:
{
"error": {
"code": 403,
"message": "Gmail API has not been used in project 549352339482 ...",
"reason": "accessNotConfigured",
"enable_url": "https://console.developers.google.com/apis/api/gmail.googleapis.com/overview?project=549352339482"
}
}gws also prints an actionable hint to stderr:
💡 API not enabled for your GCP project.
Enable it at: https://console.developers.google.com/apis/api/gmail.googleapis.com/overview?project=549352339482
After enabling, wait a few seconds and retry your command.Steps to fix:
- Click the
enable_urllink (or copy it from theenable_urlJSON field). - In the GCP Console, click Enable.
- Wait ~10 seconds, then retry your
gwscommand.
[!TIP] You can also run
gws auth setupwhich walks you through enabling all required APIs for your project automatically.
Development
cargo build # dev build
cargo clippy -- -D warnings # lint
cargo test # unit tests
./scripts/coverage.sh # HTML coverage report → target/llvm-cov/html/License
Apache-2.0
Disclaimer
[!CAUTION] This is not an officially supported Google product.
Install the whole package (92 skills):
npx skills add https://github.com/googleworkspace/cliOr install a single skill:
npx skills add https://github.com/googleworkspace/cli --skill <name>Pick the skill name from the Skills tab — each entry there installs independently.