OpenClaw + Google Workspace (gws)
Give your AI agent full access to Gmail, Drive, Calendar, Sheets, Docs, Chat, and every Google Workspace API
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.
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.
npm installgws auth setupEstimated time: ~10–15 minutes for first-time auth and skill install.
npm install -g @googleworkspace/cli
Pre-built binaries are also available on GitHub Releases.
gws walks you through OAuth setup. If you have gcloud installed:
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.
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.
gws ships with 100+ SKILL.md files. Three ways to add them to OpenClaw:
npx skills add https://github.com/googleworkspace/cli
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
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.
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.
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.
Multi-step sequences: audit shared Drive files, send personalized emails from Sheets, common productivity automations.
Once skills are installed, your OpenClaw agent can run gws commands. Examples:
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.'
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'
gws drive files list --params '{"pageSize": 10}'
gws drive +upload --file ./report.pdf --parent FOLDER_ID
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"]'
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.'
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.
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:
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.
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:
gws calendar +agenda
gws drive files list --params '{"pageSize": 5}'
enable_url hint in the error—click it, enable, wait ~10 seconds, retry.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.