Skip to main content
MindStudio
Pricing
Blog About
My Workspace
AutomationIntegrationsClaude

How to Use Google Workspace CLI with Claude Code for Full Workspace Automation

Google's new GWS CLI lets Claude Code access Gmail, Drive, Docs, Sheets, and Calendar via bash commands. Here's how to set it up and what you can automate.

MindStudio Team
How to Use Google Workspace CLI with Claude Code for Full Workspace Automation

When Every Workspace Task Is One Command Away

Most people automate Google Workspace the hard way. They write Python scripts that fight with OAuth2, set up service accounts with confusing permissions, or chain together Zapier automations that break whenever Google changes an API response format. Even small automations end up requiring hours of setup.

Google’s Workspace CLI (GWS CLI) removes most of that friction. It wraps the core Google Workspace services — Gmail, Drive, Docs, Sheets, and Calendar — into composable bash commands you can run from any terminal. Authentication is handled once, upfront. Output is structured for piping and scripting.

That matters a lot when you’re working with Claude Code. Anthropic’s agentic coding assistant runs in your terminal and executes bash commands natively. With GWS CLI installed and authenticated, Claude Code gets direct access to everything in your Google Workspace — and it can read, reason about, and act on that information across multiple steps without you managing any of it manually.

This guide covers the complete setup: installing GWS CLI, authenticating, connecting it to Claude Code, and building practical automations across Gmail, Drive, Docs, Sheets, and Calendar. It also covers common problems, how to handle rate limits, and how to structure workflows that require real reasoning between steps.


What the Google Workspace CLI Does

GWS CLI is a command-line interface for interacting with Google Workspace services programmatically. It’s built for developers and power users who want scriptable access to Workspace without writing full-blown API clients from scratch.

Services and Capabilities

The CLI covers the five main Workspace services:

Gmail

  • List, search, read, and send messages
  • Reply to threads and manage attachments
  • Apply and remove labels
  • Archive, trash, and mark messages

Google Drive

  • List, upload, download, copy, move, and delete files
  • Create folders and manage folder hierarchy
  • Set sharing permissions and access controls
  • Search by name, file type, or content

Google Docs

  • Create new documents
  • Read document content in text or structured format
  • Append or insert text
  • Export to PDF, DOCX, or plain text

Google Sheets

  • Read and write specific cell ranges
  • Create new spreadsheets
  • Append rows to existing sheets
  • Access named ranges and sheet metadata

Google Calendar

  • List events across calendars
  • Create, update, and delete events
  • Check attendee availability
  • Manage recurring events and meeting links

How It Differs from Direct API Access

The practical advantage of GWS CLI is that it handles everything that usually slows you down.

Authentication is managed through a single gws auth command. Once you authenticate, credentials are cached locally and refresh automatically. You don’t need to write OAuth flows, handle token refresh, or configure service accounts manually for most use cases.

Response formatting is handled for you. Rather than parsing raw JSON API responses, you can get output as human-readable tables, JSON, or CSV depending on what your workflow needs. That makes it straightforward to pipe output into other commands or pass it to an AI for analysis.

Error handling is also normalized. Rate limit errors, network timeouts, and API failures return consistent exit codes and messages — rather than varying unpredictably across services.

Authentication Model

GWS CLI supports two main authentication approaches:

User authentication (OAuth2): For personal Google accounts and standard Workspace accounts. You authenticate with your Google credentials in a browser window, and the CLI stores a refresh token locally. This is the right starting point for most developers and individuals.

Service account authentication: For automated workflows, server-side scripts, or situations where interactive authentication isn’t possible. Requires a service account JSON key from Google Cloud Console. More setup work upfront, but better for production automation that needs to run unattended.

For working with Claude Code during development and exploration, user authentication is the simpler choice. For deploying automation that runs on a schedule without supervision, service accounts are more reliable.


Setting Up GWS CLI with Claude Code

Before Claude Code can interact with Google Workspace, you need GWS CLI installed, authenticated, and verified. The setup takes about 20–30 minutes the first time.

Prerequisites

Before starting, make sure you have:

  • A Google account (personal or Google Workspace)
  • Node.js 18 or later installed
  • Claude Code installed and running in your terminal
  • A Google Cloud project with the relevant APIs enabled

If you don’t have a Google Cloud project yet, create one at console.cloud.google.com — it’s free. The APIs you’ll need to enable for full Workspace access are:

  • Gmail API
  • Google Drive API
  • Google Docs API
  • Google Sheets API
  • Google Calendar API

All five operate within free usage tiers for most individual and small-team workloads.

Installing GWS CLI

Install GWS CLI globally through npm:

npm install -g @google/workspace-cli

After installation, verify it’s available:

gws --version

You should see a version number. If you get a “command not found” error, check that your npm global bin directory is in your PATH. On most systems, this is ~/.npm/bin or /usr/local/bin.

Authenticating Your Google Account

Start the authentication process:

gws auth login

This opens a browser window with Google’s standard OAuth consent screen. Sign in with the Google account you want to automate, then grant the requested permissions.

After successful authentication, credentials are stored in ~/.config/gws/credentials.json. The CLI handles token refresh automatically from this point.

Verify authentication worked:

gws auth whoami

This returns your authenticated email address. If it does, you’re ready to proceed.

For service account authentication, the flow is different:

gws auth service-account --key-file=/path/to/service-account.json

Service accounts need explicit access to the resources you’re automating. For Drive and Docs, share the relevant files or folders with the service account’s email address. For Gmail and Calendar, you need domain-wide delegation configured — which requires Google Workspace admin access.

Connecting GWS CLI to Claude Code

Claude Code inherits your shell environment when it runs, so no special configuration is needed. If GWS CLI is installed and authenticated in your shell, Claude Code can use it immediately.

To confirm the connection works, start a Claude Code session and ask:

Run `gws auth whoami` and tell me what it returns.

Claude Code will execute the command and report back your authenticated email. If that works, Claude Code has full access to your GWS CLI setup.

One useful config step: set a default account if you’re working with a specific Workspace account:

gws config set default-account your@email.com

This avoids specifying the account on every command when you have multiple accounts authenticated.

Testing the Connection End-to-End

Before building any real automations, run a few test commands to confirm all services are accessible:

# List recent Gmail messages
gws gmail list --limit=5

# List files in your Drive root
gws drive ls

# List upcoming calendar events
gws calendar events list --max-results=5

# Get a specific sheet (replace with a real ID)
gws sheets list --id=YOUR_SPREADSHEET_ID

If these return data, everything is working. If you hit permission errors, check that:

  • The relevant API is enabled in your Google Cloud project
  • Your OAuth token includes the required scopes
  • For service accounts, the account has access to the specific resource

Automating Gmail with Claude Code and GWS CLI

Gmail is often where Workspace automation has the most immediate impact. People spend significant time manually triaging, sorting, and responding to messages that follow predictable patterns. Claude Code combined with GWS CLI can handle a large chunk of this.

Reading and Searching Email

The gws gmail list command supports Gmail’s native search syntax, so you filter messages the same way you’d use the Gmail search bar:

# Get unread emails from the last 24 hours
gws gmail list --query="is:unread newer_than:1d"

# Find emails from a specific sender
gws gmail list --query="from:client@company.com"

# Search by subject content
gws gmail list --query="subject:invoice is:unread"

# Combine multiple filters
gws gmail list --query="from:boss@company.com is:unread has:attachment"

# Get emails with a specific label
gws gmail list --query="label:action-required"

To read the full content of a specific message:

# Get full message including headers
gws gmail get --id=MESSAGE_ID

# Get just the body as plain text
gws gmail get --id=MESSAGE_ID --format=text

# Get with attachment list
gws gmail get --id=MESSAGE_ID --include-attachments

For formatted JSON output that Claude Code can parse more easily:

gws gmail list --query="is:unread newer_than:1d" --format=json

When you ask Claude Code to triage your inbox, it combines these commands with actual reasoning. A prompt like “Look through my unread emails from the past 48 hours and summarize which ones need a response today” triggers Claude Code to list emails, fetch the relevant content, reason about priority, and return a structured summary — all without you specifying each step.

Sending and Replying to Emails

Sending a new email:

gws gmail send \
  --to="recipient@example.com" \
  --subject="Project update" \
  --body="Here's the latest status on the project..."

For longer bodies or when you want Claude Code to draft the content, use a file:

gws gmail send \
  --to="recipient@example.com" \
  --subject="Monthly report" \
  --body-file=report.txt \
  --attachment=report.pdf

Sending to multiple recipients:

gws gmail send \
  --to="alice@example.com,bob@example.com" \
  --cc="manager@example.com" \
  --subject="Team update" \
  --body="Weekly status below..."

Replying to an existing thread:

gws gmail reply --thread-id=THREAD_ID --body="Thanks for the update. I'll review by Friday."

Claude Code is particularly good at drafting context-aware responses. If you tell it “Read the last email from [contact] and draft a professional reply acknowledging their request and asking for a deadline,” it reads the thread, understands the context, writes a reply that matches the tone and content, and either sends it or shows you the draft first.

Managing Labels and Threads

Labels are how Gmail organizes everything, and GWS CLI supports full label management:

# List all labels in your account
gws gmail labels list

# Apply a label to a message
gws gmail label add --message-id=ID --label="Action Required"

# Remove a label
gws gmail label remove --message-id=ID --label="INBOX"

# Create a new label
gws gmail labels create --name="Client: Acme Corp"

# Archive a message (removes Inbox label)
gws gmail archive --id=MESSAGE_ID

# Mark as read
gws gmail mark-read --id=MESSAGE_ID

A useful automation: ask Claude Code to go through your unread mail and auto-apply labels based on content. You end up with a triage system that runs on-demand or on a schedule.

Building an Email Triage Workflow

Here’s a concrete example of what you can ask Claude Code to do once GWS CLI is configured:

Check my unread emails from the last 24 hours. For each one:
1. Categorize it as: action required, FYI only, or newsletter/promo
2. For action-required emails, draft a one-sentence response I can review
3. Apply the appropriate Gmail label to each message
4. Return a summary of what actually needs my attention today

Claude Code runs a sequence of GWS commands — listing emails, fetching content for each, applying labels based on its reasoning, and drafting responses — then returns a clean summary. This kind of workflow replaces 30–45 minutes of manual inbox work.

Downloading and Processing Attachments

Working with email attachments:

# List attachments in a message
gws gmail attachments list --message-id=MESSAGE_ID

# Download a specific attachment
gws gmail attachments download \
  --message-id=MESSAGE_ID \
  --attachment-id=ATTACHMENT_ID \
  --output=./downloads/

# Download all attachments from a search
gws gmail attachments bulk-download \
  --query="from:invoices@supplier.com has:attachment" \
  --output=./invoices/

Combine this with Claude Code’s ability to read files, and you can build workflows like: “Download all invoice PDFs from this vendor, extract the totals, and log them to a spreadsheet.”


Managing Google Drive and Docs via Command Line

Google Drive and Docs are where most knowledge work lives. GWS CLI gives you command-line access to both — file management, document creation, content operations, and permission control.

Basic Drive operations use a filesystem-like syntax:

# List files in your Drive root
gws drive ls

# List files in a specific folder
gws drive ls --parent=FOLDER_ID

# Search for files by name
gws drive search --query="name contains 'Q4 Report'"

# Search by file type
gws drive search --query="mimeType='application/vnd.google-apps.document'"

# Search by content (full-text search)
gws drive search --query="fullText contains 'budget 2025'"

# Create a folder
gws drive mkdir "Projects/2025/Q2"

# Upload a local file
gws drive upload --file=report.pdf --parent=FOLDER_ID

# Download a file
gws drive download --id=FILE_ID --output=./local-copy.pdf

# Copy a file within Drive
gws drive copy --id=FILE_ID --name="Copy of Q4 Report" --parent=FOLDER_ID

# Move a file
gws drive move --id=FILE_ID --parent=NEW_FOLDER_ID

# Send to trash
gws drive trash --id=FILE_ID

For batch operations, you can combine gws drive search output with subsequent commands. Ask Claude Code to “find all files in the [project folder] that haven’t been modified in 90 days and move them to the Archive folder” — it will run the search, filter by modification date, and execute the moves.

Getting File Metadata

# Get detailed info about a file
gws drive info --id=FILE_ID

# List file permissions
gws drive permissions list --id=FILE_ID

# Get file revision history
gws drive revisions list --id=FILE_ID

This is useful when you need to audit what’s been shared or modified — something that’s tedious to check manually across dozens of files.

Creating and Editing Docs

Creating a new Google Doc:

gws docs create --title="Meeting Notes - June 2025"

The command returns the new document’s ID, which you use for subsequent operations.

Reading an existing document:

# Get full document content
gws docs get --id=DOCUMENT_ID

# Get as plain text
gws docs get --id=DOCUMENT_ID --format=text

# Get structured content (headings, paragraphs)
gws docs get --id=DOCUMENT_ID --format=json

Appending content:

# Append text directly
gws docs append --id=DOCUMENT_ID --text="Additional section content here..."

# Append from a file
gws docs append --id=DOCUMENT_ID --file=new-section.txt

Exporting to other formats:

# Export as PDF
gws docs export --id=DOCUMENT_ID --format=pdf --output=document.pdf

# Export as DOCX for sharing with non-Google users
gws docs export --id=DOCUMENT_ID --format=docx --output=document.docx

# Export as plain text
gws docs export --id=DOCUMENT_ID --format=txt --output=document.txt

A practical use case: Claude Code reads a project brief document, extracts the key requirements, and creates a new structured task list document populated with those requirements — all in one go.

Setting Sharing Permissions

Sharing files and folders:

# Share with a specific user as editor
gws drive share --id=FILE_ID --email=colleague@company.com --role=editor

# Share as view-only
gws drive share --id=FILE_ID --email=external@client.com --role=reader

# Make a file publicly accessible with a link
gws drive share --id=FILE_ID --role=reader --type=anyone

# Get the shareable link
gws drive get-link --id=FILE_ID

# Remove a user's access
gws drive unshare --id=FILE_ID --email=former-colleague@company.com

# Transfer ownership
gws drive transfer-ownership --id=FILE_ID --email=newowner@company.com

For teams, this enables automatic permission management — ensuring the right people have access when a project starts, and revoking external access when it ends. That kind of administrative work often falls through the cracks manually.


Google Sheets and Calendar: Data and Scheduling Automation

Sheets and Calendar are two of the most automation-friendly Workspace services. Sheets works well as a lightweight database and reporting layer. Calendar automation can save real time on the scheduling and coordination that takes up too much of most workdays.

Reading and Writing Spreadsheet Data

Getting data from a spreadsheet:

# Read a specific range
gws sheets get --id=SPREADSHEET_ID --range="Sheet1!A1:E100"

# Read a named range
gws sheets get --id=SPREADSHEET_ID --range="SalesData"

# Get as JSON for processing
gws sheets get --id=SPREADSHEET_ID --range="Sheet1!A1:E100" --format=json

# Get as CSV for easy parsing
gws sheets get --id=SPREADSHEET_ID --range="Sheet1!A1:E100" --format=csv

# Get entire column
gws sheets get --id=SPREADSHEET_ID --range="Sheet1!B:B"

Writing data back:

# Update a single cell
gws sheets update --id=SPREADSHEET_ID --range="Sheet1!B2" --value="Updated"

# Update a range from CSV
gws sheets update --id=SPREADSHEET_ID --range="Sheet1!A1" --file=data.csv

# Append a new row
gws sheets append --id=SPREADSHEET_ID --range="Sheet1" --values="Val1,Val2,Val3"

# Append from CSV file
gws sheets append --id=SPREADSHEET_ID --range="Sheet1" --file=new-rows.csv

Creating a new spreadsheet:

gws sheets create --title="Q2 2025 Expense Report"

Claude Code uses Sheets as both a data source and a destination for multi-step workflows. For example: “Read all the data from the Sales Pipeline spreadsheet, identify deals that haven’t been updated in 30 days, and add them to a ‘Stale Deals’ tab along with the last update date.” This requires reading data, applying logic, filtering, and writing — exactly the kind of multi-step reasoning Claude Code handles well.

Working with Multiple Sheets

Real spreadsheets usually have multiple tabs. GWS CLI handles these with standard A1 range notation:

# Read from a specific tab
gws sheets get --id=SPREADSHEET_ID --range="'Q1 Data'!A:Z"

# List all tabs in a spreadsheet
gws sheets list-tabs --id=SPREADSHEET_ID

# Add a new tab
gws sheets add-tab --id=SPREADSHEET_ID --title="Q2 Data"

# Copy a tab to another spreadsheet
gws sheets copy-tab \
  --source-id=SPREADSHEET_ID \
  --tab="Template" \
  --destination-id=NEW_SPREADSHEET_ID

Automating Calendar Events

Getting events:

# List today's events
gws calendar events list --calendar=primary --date=today

# List events for the next 7 days
gws calendar events list --calendar=primary --days=7

# Get events in a date range
gws calendar events list \
  --calendar=primary \
  --time-min="2025-06-01T00:00:00Z" \
  --time-max="2025-06-30T23:59:59Z"

# Search events by title
gws calendar events list --calendar=primary --query="team standup"

# List events from a specific calendar
gws calendar events list --calendar=CALENDAR_ID

Creating events:

# Create a simple event
gws calendar events create \
  --calendar=primary \
  --title="Team Review" \
  --start="2025-06-20T14:00:00" \
  --end="2025-06-20T15:00:00" \
  --attendees="alice@company.com,bob@company.com" \
  --description="Quarterly review meeting"

# Create an all-day event
gws calendar events create \
  --calendar=primary \
  --title="Project Deadline" \
  --date="2025-06-30" \
  --all-day

# Create a recurring event
gws calendar events create \
  --calendar=primary \
  --title="Weekly Check-in" \
  --start="2025-06-16T10:00:00" \
  --end="2025-06-16T10:30:00" \
  --recurrence="RRULE:FREQ=WEEKLY;BYDAY=MO"

Checking availability before scheduling:

gws calendar freebusy \
  --start="2025-06-20T09:00:00" \
  --end="2025-06-20T17:00:00" \
  --attendees="alice@company.com,bob@company.com"

Claude Code can use free/busy information intelligently. Tell it “Find a 1-hour slot next week where Alice and Bob are both free, avoid mornings, and schedule a project kickoff meeting” — it will check availability across the date range, find the right slot, create the event with both attendees, and confirm the booking.

Calendar-to-Sheets Reporting

One particularly useful combined workflow: pulling calendar data into a spreadsheet for time tracking or meeting analytics.

Ask Claude Code something like:

Look at all calendar events from last month with more than 2 attendees.
Extract the title, duration, attendee count, and my role (organizer or attendee).
Create a summary in the "Meeting Analysis" spreadsheet tab.

Claude Code will run the calendar query, process the results, and write the structured data to Sheets. This kind of analysis usually requires manual export and manipulation in Excel — here it’s a single prompt.


Building Multi-Step Workspace Workflows

Individual GWS CLI commands are useful on their own. But the real value comes from chaining them across multiple services where actual reasoning is needed between steps.

How Claude Code Handles Multi-Step Workflows

Claude Code doesn’t just run commands mechanically — it reasons between them. This means you can give it a high-level objective like “prepare the weekly client report” and it will:

  1. Figure out what steps are needed based on the objective
  2. Run the appropriate GWS commands to gather information
  3. Process and analyze what it gets back
  4. Adapt its next steps based on what it found
  5. Create outputs, update records, or send communications
  6. Handle edge cases and errors as they come up

This is different from a shell script or a Zapier workflow where every step is hard-coded. Claude Code can adjust based on what it actually finds.

Real-World Workflow Examples

Morning briefing

Look at my Gmail for unread emails from the past 12 hours. Check my calendar
for today's events. Look at the "Active Tasks" tab in my project tracker 
spreadsheet. Create a daily briefing doc in my "Daily Notes" Drive folder with:
- Key emails that need a response (with a brief summary of each)
- Today's schedule
- Tasks I planned to work on today

Then send me a short email with the 3 most important things.

This touches Gmail, Calendar, Sheets, Docs, and Gmail again — five services in a logical sequence. With GWS CLI and Claude Code, it’s a single prompt.

End-of-project cleanup

The Acme Corp project is complete. Please:
1. Find all files in Drive tagged or named with "Acme Corp"
2. Move them to the Archive/Completed Projects folder
3. Update the Project Status spreadsheet to mark Acme Corp as complete with today's date
4. Remove edit access from the project team's external collaborators (keep read access)
5. Send a brief closing email to the project team confirming everything is archived

Weekly status report

It's Friday. Compile the weekly status report:
1. Read the Task Tracker spreadsheet — find tasks completed this week and blockers
2. Read all documents in the "Meeting Notes/Week of June 16" folder
3. Create a new doc in Drive from the Weekly Report template
4. Fill it in with completed work, blockers mentioned in notes, and decisions made
5. Share the report with the team and send a brief email notifying them it's ready

Automated invoice logging

Look for emails from accounting@supplier.com received in the last 30 days with 
PDF attachments. Download the attachments to a local folder. For each invoice,
extract the invoice number, date, and amount from the filename (or ask me if 
it's unclear). Log everything to the "Vendor Invoices 2025" spreadsheet.

Chaining Commands with Shell Scripting

For workflows you want to run on a schedule, wrap GWS CLI commands in a shell script and use cron or a task scheduler:

#!/bin/bash
# weekly-report-prep.sh

# Get last week's calendar events
EVENTS=$(gws calendar events list \
  --calendar=primary \
  --days=-7 \
  --format=json)

# Get completed tasks from tracker
TASKS=$(gws sheets get \
  --id="YOUR_SPREADSHEET_ID" \
  --range="Tasks!A:F" \
  --format=csv)

# Create a working file
echo "Week ending: $(date)" > weekly-input.txt
echo "\n=== CALENDAR ===\n" >> weekly-input.txt
echo $EVENTS >> weekly-input.txt
echo "\n=== TASKS ===\n" >> weekly-input.txt
echo $TASKS >> weekly-input.txt

# Upload to Drive for Claude Code to process
gws drive upload --file=weekly-input.txt --parent="REPORTS_FOLDER_ID"

You can then ask Claude Code to process this file and generate the actual report document. It can also help you improve the script itself — adding error handling, better formatting, or additional data sources.

Common Issues and How to Fix Them

Rate limit errors

Google Workspace APIs have per-user and per-project quotas. GWS CLI handles most rate limit errors with automatic backoff retries. For large bulk operations, add explicit delays between requests:

# Process emails with a delay between each
gws gmail list --query="is:unread" --format=json | jq -r '.[].id' | while read id; do
  gws gmail get --id=$id
  sleep 0.5
done

If you’re consistently hitting rate limits, check your Google Cloud Console quotas and request increases if needed.

Authentication expiry

For long-running automated scripts, check credential status before executing:

gws auth status

If the token has expired, refresh it:

gws auth refresh

For production automation that runs without user interaction, use service accounts rather than user OAuth tokens — service account credentials don’t expire the same way.

Permission errors on specific files

If a command returns a permissions error on a specific file or folder, confirm:

  • The authenticated account has access to that resource
  • The required API is enabled in your Google Cloud project
  • Your OAuth token includes the necessary scope

Running gws auth scopes shows what your current token covers.

Encoding issues with non-ASCII content

When reading documents with non-ASCII characters, add --encoding=utf-8 to export and get commands:

gws docs export --id=DOCUMENT_ID --format=txt --encoding=utf-8 --output=doc.txt

Large file operations timing out

For large Drive uploads or downloads, use the --resume flag to enable resumable transfers that can recover from network interruptions:

gws drive upload --file=large-file.zip --parent=FOLDER_ID --resume

Extend Workspace Automation Without Code in MindStudio

GWS CLI with Claude Code is powerful for interactive, on-demand automation. But it has practical constraints: it requires terminal access, the person running it needs to be comfortable with command-line tools, and it doesn’t run on its own without manual prompting.

For teams or individuals who want Workspace automation that runs on a schedule, responds to triggers, or needs to be accessible to non-technical colleagues, a different approach makes more sense.

MindStudio is a no-code platform for building AI agents, and it has native Google Workspace integrations built in — Gmail, Drive, Docs, Sheets, Calendar, and more. Rather than managing CLI authentication and writing bash commands, you can visually build workflows that connect Workspace services to AI reasoning and other business tools.

The practical difference: GWS CLI + Claude Code is great when you want to handle something right now, interactively, with the AI reasoning through it in real time. MindStudio is better for automation that needs to happen consistently, automatically, and without you being at the terminal.

Consider the morning briefing workflow described earlier. As a Claude Code session, you run it manually when you remember. As a MindStudio agent, it runs every morning at 9am, gathers data from Gmail, Calendar, and Sheets, generates the briefing, and sends it — without you touching anything.

MindStudio’s built-in scheduling, trigger handling, error recovery, and credential management means you’re not responsible for the infrastructure layer. You build the logic, MindStudio handles the execution. Non-technical teammates can build and manage similar workflows themselves through the visual builder.

For developers who want their own AI agents — Claude Code included — to access a broader set of integrations as simple method calls, MindStudio’s Agent Skills Plugin provides an npm SDK with 120+ typed capabilities. Methods like agent.sendEmail(), agent.searchGoogle(), and agent.runWorkflow() work alongside tools like GWS CLI, letting you combine Workspace automation with CRM updates, web search, image generation, and more.

You can start for free at mindstudio.ai.


Frequently Asked Questions

Is the Google Workspace CLI free to use?

GWS CLI itself is free. The underlying Google Workspace APIs are also free within standard usage quotas. For most individual and small-team use cases, you won’t approach any limits. High-volume automation — processing thousands of emails per day or making hundreds of Drive operations per minute — may require you to review Google’s quota documentation and request increases through Google Cloud Console. Normal daily workflows are well within the free tier.

Does GWS CLI work with Google Workspace for Business accounts?

Yes, with some considerations. Both personal Google accounts and Google Workspace for Business accounts work with user OAuth authentication. However, some Workspace for Business features — domain-wide delegation, shared drives with complex permission structures, or administrative operations like user management — require additional configuration or admin access.

If you’re using GWS CLI within a business organization, check with your Workspace admin about OAuth app approval policies. Some organizations require admin approval before OAuth apps can access Workspace APIs, and some restrict which scopes can be granted to third-party applications.

Can Claude Code access private Google Drive files?

Claude Code can access any files that your authenticated GWS CLI account has permission to view. If you’ve authenticated as yourself and a file is shared with you (or is in your own Drive), Claude Code can read it using GWS CLI commands. Files you don’t have access to — or files in shared drives where you lack permissions — will return standard permission errors.

The access model mirrors what you’d see in the Drive web interface. GWS CLI doesn’t bypass or elevate your existing permissions, so the same access control applies.

How does GWS CLI handle API rate limiting?

GWS CLI has built-in retry logic with exponential backoff for rate limit errors. For most operations, this is transparent — if a request hits a limit, the CLI waits and retries automatically. For bulk operations processing large numbers of files or emails in a short period, adding explicit delays between operations reduces the likelihood of hitting limits in the first place.

Google’s rate limits vary by API and operation type. The Gmail API, for example, uses a quota unit system where different operations cost different amounts. The Drive API has both per-user and per-project quotas. GWS CLI surfaces rate limit errors clearly if they’re not resolved by automatic retries, so you know when you need to slow down or request a quota increase.

Is this approach secure?

The main security points to be aware of:

Credential storage: OAuth credentials are stored locally in ~/.config/gws/. Keep your machine secure and don’t share this directory. Service account keys, if used, should be treated as secrets and kept out of version control — use environment variables or a secrets manager instead.

OAuth scopes: When you authenticate, you grant specific API scopes. Use the minimum scopes that actually cover your use case. Don’t grant broad Gmail or Drive access if you only need read access to specific resources.

What Claude Code processes: When Claude Code runs GWS commands and reads responses, document and email content passes through Claude’s context window. Be thoughtful about what sensitive information you expose to AI processing — financial records, confidential client communications, or personal data deserve consideration before being passed through any AI system.

Audit trails: Google Workspace for Business accounts log API access in the Admin Console. You can review what your application has accessed and when.

Overall, GWS CLI uses standard Google OAuth2 security — the same mechanism used by every Google-connected application. The security posture is comparable to connecting any third-party app to your Google account, with the additional consideration that Claude Code processes the content as part of its reasoning.

What’s the difference between GWS CLI and Google Apps Script?

Google Apps Script runs inside Google’s infrastructure and is designed for automation within the Workspace ecosystem. It works well for triggered actions (like running a script when a form is submitted), has tight native integration with Workspace services, and requires no local setup. But it runs on Google’s servers with execution time limits, has its own learning curve, and isn’t easy to combine with external tools or custom environments.

GWS CLI runs locally in your shell environment. This makes it straightforward to combine with other command-line tools, integrate into existing development workflows, use with AI coding assistants like Claude Code, and incorporate into scripts that touch non-Google services. For automation that needs to interact with multiple systems or requires complex conditional logic, GWS CLI gives you more flexibility. For simple trigger-based Workspace automation that lives entirely within Google, Apps Script may be the simpler choice.


Key Takeaways

Getting GWS CLI set up with Claude Code takes about 30 minutes. What you get afterward is a significantly faster way to handle work that used to require either manual browser time or complex API scripting.

Here’s the short version of everything covered:

  • GWS CLI handles authentication and API wrapping, so Claude Code can interact with Gmail, Drive, Docs, Sheets, and Calendar through simple bash commands rather than complex API clients.
  • Claude Code’s strength is multi-step reasoning — it can chain GWS commands intelligently, adapt based on what it finds at each step, and handle edge cases rather than following a rigid predetermined script.
  • Individual service automations are practical to build: email triage, file organization, document creation, spreadsheet data operations, and calendar scheduling all work reliably with the approach described here.
  • Complex cross-service workflows — like a weekly report that pulls from Sheets, reads meeting notes from Drive, creates a formatted document, and sends an email — are where this combination is most useful.
  • The setup is mostly one-time work: authenticate GWS CLI once, verify it works with Claude Code, and you have a foundation you can build on repeatedly.
  • For scheduled, triggered, or team-accessible automation, MindStudio complements this approach well — handling the workflows that need to run automatically without anyone at the terminal.

If you spend a meaningful amount of time on routine Workspace tasks each week, the setup investment pays off quickly. The individual automations compound once you have the foundation in place.