Skip to content
tech

I Gave Claude Code Access to My Google Workspace — And It Does Everything

·5 min read·5 views

My AI agent has access to my Gmail, Google Drive, Calendar, Sheets, and Tasks. It reads emails, sends replies, creates events, organizes files, and fills spreadsheets — all through natural language.

This isn't a limited integration. It's 33 Google Workspace APIs exposed on my server's terminal, ready to be operated by Claude Code. It can do everything I'd do in the web interface. The difference is I ask in plain English and it executes.

How it works

The bridge between Claude Code and Google Workspace is a CLI called gws — Google Workspace CLI. It's open-source, maintained by the Google Workspace team, and works like this: it reads API definitions directly from Google's Discovery Service at runtime. Any endpoint Google exposes, gws supports automatically.

I installed it on my server, authenticated with OAuth once, and created a skill — a markdown file that teaches Claude Code how to use each API. It's the same concept I described in my brain vault post: teaching AI to operate tools persistently.

With the skill loaded, Claude Code knows the exact syntax for each command. I ask in natural language, it translates to the right command, executes, parses the JSON response, and answers like a human would.

What it does with my Gmail

Filters and searches. I ask "what arrived that's important today?" and it lists unread emails, groups by sender, and summarizes the content. I ask "find AWS emails from the last week" and it filters by sender and date.

gws gmail users messages list 
  --params '{"userId": "me", "q": "from:aws newer_than:7d"}'

Reads messages. Not just subjects — it downloads full content, including attachments. Once I asked it to search for DMARC reports and it downloaded compressed XMLs, decompressed them, parsed them, and showed me the IPs spoofing my domain. All without me opening Gmail.

Sends emails. I ask "send Lucas an email with yesterday's report" and it composes the message, encodes it in base64url RFC 2822 format, and sends through the API.

gws gmail users messages send 
  --params '{"userId": "me"}' 
  --body '{"raw": "<base64url-encoded-message>"}'

Deletes and organizes. "Clean up newsletter emails I didn't open in the last month." It searches, filters, and moves to trash.

What it does with Calendar

Checks the agenda. "What do I have today?" — and it tells me "2 meetings, first at 10am with a client, second at 4pm for a PR review."

gws calendar events list 
  --params '{"calendarId": "primary", "timeMin": "2026-03-20T00:00:00-03:00", "timeMax": "2026-03-20T23:59:59-03:00", "singleEvents": true, "orderBy": "startTime"}'

Creates events. "Schedule a meeting tomorrow at 2pm to review the deploy, 1 hour." It creates it with the right timezone, duration, and title.

Cancels and reschedules. "Move tomorrow's meeting to Friday at 10am." It finds the event, updates it, confirms.

What it does with Drive and Sheets

Searches files. "What's the last document I edited?" — it lists by modification date and shows me.

gws drive files list 
  --params '{"pageSize": 5, "orderBy": "modifiedTime desc", "fields": "files(id,name,mimeType,modifiedTime)"}'

Creates spreadsheets with data. "Save these results in a new spreadsheet." It creates the spreadsheet and populates it with the data I provided.

gws sheets spreadsheets values update 
  --params '{"spreadsheetId": "abc123", "range": "A1", "valueInputOption": "USER_ENTERED"}' 
  --body '{"values": [["Metric", "Value"], ["Uptime", "99.8%"], ["Requests", "47k"]]}'

Reads existing spreadsheet data. "Pull the data from the cost spreadsheet." Clean JSON back, which it interprets and summarizes.

What it does with Tasks

Lists tasks. "What do I have pending?" — it queries task lists and gives me a summary.

Creates tasks. "Add a task: review Nginx config by Friday." Done.

The skill that makes it all work

Without the skill, Claude Code would have to guess each API's syntax every conversation. With the skill, it knows exactly which command to run, which parameters to pass, and how to interpret the response.

The skill covers: email search, message reading, sending (including base64url encoding), event creation and querying, file listing, spreadsheet reading and writing, task management, and even API introspection with gws schema — a command that lets the agent discover any method from any Google API on its own.

This skill is part of my open-source repo claude-skills with 44+ skills. If you already use Claude Code, it's plug and play.

The cost of delegation

I'll be honest: giving full Google Workspace access to an AI agent requires trusting the tool. I use minimal scopes when possible — gmail.readonly if I only need to read, gmail.send when I need to send. OAuth authentication means I can revoke access at any time from the Google console.

The OAuth token requires a browser for initial authentication. On my headless server, I copied the URL, authorized on my laptop, pasted the code back. Did it once. The refresh token persists for months.

The pattern: give access, create the skill, delegate

It's the same pattern I use to connect Meta Ads to Claude Code:

  1. Find the tool that exposes the service via terminal
  2. Create the skill that teaches the agent how to use it
  3. Delegate and interact through conversation

Google Workspace is the most transformative case because it's where everyone's daily routine lives — email, calendar, documents, spreadsheets. When your agent has access to all of this, it stops being a tool you use and becomes an assistant that operates alongside you.

The most surprising part isn't the technology. It's how quickly you forget there was ever another way to check email.

Want to apply this to your project?

Career, code & digital product consulting.

Work with Billy
Billy

Billy

Full Stack Dev & Empreendedor Solo

Building products with code and AI. Creator of HubNews and Sistema Reino.