OpenClaw + Google Workspace (gws)

Give your AI agent full access to Gmail, Drive, Calendar, Sheets, Docs, Chat, and every Google Workspace API

gws (Google Workspace CLI) is a single command-line tool that gives OpenClaw direct access to Gmail, Drive, Calendar, Sheets, Docs, Chat, Admin, Meet, Forms, Keep, and more. It ships with 100+ agent skills in the same SKILL.md format OpenClaw uses, and the README includes first-class OpenClaw setup instructions. Every response is structured JSON—agent-ready out of the box.

What Is gws?

gws wraps every Google Workspace API into clean CLI commands. Instead of hardcoding a fixed list of commands, it reads Google's Discovery Service at runtime—so when Google adds new APIs or methods, gws picks them up automatically. The gws-shared skill includes an install block so OpenClaw can auto-install the CLI via npm if gws is not on PATH. No manual setup required once you install the skills.

Not an officially supported Google product. Maintained by Google engineers; Apache-2.0 license.

Prerequisites

  • Node.js 18+ — for npm install
  • Google Cloud project — required for OAuth. Create via Cloud Console or gws auth setup
  • Google account with Google Workspace or Gmail access
  • OpenClaw installedGetting Started first if needed

Estimated time: ~10–15 minutes for first-time auth and skill install.

Step 1: Install gws

Install gws
npm install -g @googleworkspace/cli

Pre-built binaries are also available on GitHub Releases.

Step 2: Authenticate

gws walks you through OAuth setup. If you have gcloud installed:

Auth setup
gws auth setup     # one-time: creates project, enables APIs, logs you in
gws auth login     # subsequent logins

Without gcloud, use manual OAuth setup in the Google Cloud Console. Add yourself as a test user on the OAuth consent screen or login will fail.

Scope limits (testing mode): Unverified OAuth apps are limited to ~25 scopes. If gws auth login fails with a scope error, pick individual services: gws auth login -s drive,gmail,calendar.

Multi-account: You can add work, personal, or agent-dedicated accounts later. For a separate agent email, grant Full Access; for personal/work email, start with Limited Access and adjust as needed.

Step 3: Install OpenClaw Skills

gws ships with 100+ SKILL.md files. Three ways to add them to OpenClaw:

Option A: Install all skills (recommended)

Install all gws skills
npx skills add https://github.com/googleworkspace/cli

Option B: Pick specific skills

Install specific skills
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
npx skills add https://github.com/googleworkspace/cli/tree/main/skills/gws-calendar

Option C: Symlink (development, stays in sync)

Symlink skills
git clone https://github.com/googleworkspace/cli.git
cd cli
ln -s $(pwd)/skills/gws-* ~/.openclaw/skills/

If your OpenClaw workspace uses a different skills path (e.g. ~/clawd/skills/), symlink there. The gws-shared skill auto-installs the CLI via npm when the agent needs it.

What Your Agent Can Do

Service skills (25+)

One skill per Google Workspace API: gws-drive, gws-gmail, gws-calendar, gws-sheets, gws-docs, gws-slides, gws-tasks, gws-chat, gws-meet, gws-forms, gws-keep, gws-admin, gws-classroom, and more.

Persona skills (10 pre-built roles)

Ready-to-use agent roles: Executive Assistant, Project Manager, HR Coordinator, Sales Ops, IT Admin, Content Creator, Customer Support, Event Coordinator, Team Lead, Researcher. Each bundles the right service skills and workflows.

Recipe skills (50 curated workflows)

Multi-step sequences: audit shared Drive files, send personalized emails from Sheets, common productivity automations.

Quick Examples

Once skills are installed, your OpenClaw agent can run gws commands. Examples:

Gmail
gws gmail users messages list --params '{"userId": "me", "q": "is:unread"}'
gws gmail +send --to alice@company.com --subject 'Q2 Report Ready' --body 'Hey Alice, the report is ready.'
Calendar
gws calendar +agenda
gws calendar +insert --summary 'Weekly Standup' --start '2026-03-10T09:00:00-07:00' --end '2026-03-10T09:30:00-07:00'
Drive
gws drive files list --params '{"pageSize": 10}'
gws drive +upload --file ./report.pdf --parent FOLDER_ID
Sheets
gws sheets +read --spreadsheet-id SHEET_ID --range 'Contacts!A2:C'
gws sheets +append --spreadsheet-id SHEET_ID --range 'Sheet1' --values '["2026-03-05", "Marketing", "Ad spend", "1500"]'
Docs
gws docs documents create --json '{"title": "Meeting Notes - March 2026"}'
gws docs +write --document-id DOC_ID --text '## Project: Q2 Launch\n\n### Objective\nLaunch the new feature by end of Q2.'
Google Chat
gws chat +send --space spaces/TEAM_SPACE --text 'Important: Please check your email for the updated policy.'

The + helper commands (+send, +agenda, +upload, +read, +append, +write, etc.) handle encoding and formatting so your agent doesn't need to deal with boilerplate.

Security: Model Armor

gws supports Google Cloud Model Armor for response sanitization. When your agent reads Gmail or Drive, that data could contain prompt-injection attempts. Model Armor scans API responses before they reach your agent:

Sanitize with Model Armor
gws gmail users messages get --params '...' \
  --sanitize "projects/P/locations/L/templates/T"

Use warn mode (flag but return) or block mode (strip suspicious content). Set GOOGLE_WORKSPACE_CLI_SANITIZE_TEMPLATE and GOOGLE_WORKSPACE_CLI_SANITIZE_MODE for defaults. See OpenClaw security for agent hardening.

Step 4: Test Your Setup

Verify the agent can use gws. In chat, ask OpenClaw to run a simple command—e.g. "Check my calendar for today" or "List my 5 most recent Drive files". If the agent returns structured data from Google, the skills and auth are working. You can also run gws directly in a terminal to confirm auth:

Test gws
gws calendar +agenda
gws drive files list --params '{"pageSize": 5}'

Troubleshooting

  • "Access blocked" or 403 during login: Your OAuth app is in testing mode and your account is not a test user. In the OAuth consent screen → Test users → Add users → enter your Google email.
  • "Google hasn't verified this app": Expected for testing mode. Click Advanced → Go to [app name] (unsafe) to proceed. Safe for personal use.
  • redirect_uri_mismatch: The OAuth client was not created as a Desktop app type. Delete and recreate with type Desktop app.
  • API not enabled (accessNotConfigured): Enable the required API in Google Cloud Console. gws prints an enable_url hint in the error—click it, enable, wait ~10 seconds, retry.
  • gcloud not found: Install gcloud (e.g. brew install --cask google-cloud-sdk on macOS) or use manual OAuth setup.

Headless/CI: run gws auth export --unmasked on a machine with a browser, then set GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE on the headless machine. See the gws Troubleshooting section for more.

Related

Resources