テックトレンド

The Revolutionary CLI That Changes How You Use Google Workspace: A Deep Dive into 'gog' and AI-Powered Workflows

2026-01-26濱本 隆太

"gog" is a command-line interface for Google Workspace that enables scripting, automation, and AI agent integration across Gmail, Calendar, Drive, and Docs. This guide explains what it is and how to use it.

The Revolutionary CLI That Changes How You Use Google Workspace: A Deep Dive into 'gog' and AI-Powered Workflows
シェア

What gog Is

gog (Google Operations Gateway) is an open-source command-line interface that provides programmatic access to Google Workspace services from the terminal. It supports Gmail, Google Calendar, Google Drive, Google Docs, Google Sheets, and Google Meet.

For users who are comfortable in a terminal environment, gog changes the way Google Workspace can be used. Instead of navigating between browser tabs and clicking through interfaces, you can compose, query, and automate across all Google services from a single command-line session.

More importantly for the current AI moment: gog exposes Google Workspace operations as commands that AI agents can call, making it possible to integrate Google Workspace into agentic workflows without writing custom API integration code for each service.

Why This Matters for AI Workflows

The typical AI assistant integration with Google Workspace works through browser automation or API wrappers that need to be configured per application. gog provides a unified interface that any tool capable of running shell commands — including Claude Code, OpenClaw, and similar AI agent frameworks — can use without additional configuration.

This is a significant practical simplification. An AI agent that needs to read emails, check calendar availability, and create a document can do all three through gog commands without requiring separate integration points for each service.

Interested in leveraging AI?

Download our service materials. Feel free to reach out for a consultation.

Installation and Setup

Requirements

  • Python 3.9 or later
  • A Google account with Google Workspace (or standard Google account)
  • Google Cloud Console access for OAuth credentials

Installing gog

pip install gog-workspace

Initial Configuration

The first time you run gog, it will walk you through OAuth authentication:

gog auth login

This opens a browser window for Google authentication. After granting permissions, credentials are stored locally for subsequent sessions.

To verify the connection:

gog status

Core Commands

Gmail

# List unread emails
gog gmail list --unread

# Search emails
gog gmail search "from:boss@company.com subject:quarterly report"

# Read a specific email
gog gmail read <email-id>

# Send an email
gog gmail send --to "colleague@company.com" --subject "Update" --body "Here's the update..."

# Reply to an email
gog gmail reply <email-id> --body "Thanks for the information."

Calendar

# Show today's events
gog calendar list --today

# Show events for a date range
gog calendar list --from 2026-02-01 --to 2026-02-07

# Create a new event
gog calendar create --title "Project Review" --start "2026-02-10T14:00" --end "2026-02-10T15:00" --attendees "team@company.com"

# Find free time
gog calendar freetime --date 2026-02-10 --duration 60

Google Drive

# List files
gog drive list --folder "Projects"

# Search files
gog drive search "quarterly report"

# Download a file
gog drive download <file-id> --output ./local-copy.pdf

# Upload a file
gog drive upload ./document.pdf --folder "Shared"

Google Docs

# Create a new document
gog docs create --title "Meeting Notes" --content "## Attendees\n\n## Discussion"

# Read document content
gog docs read <doc-id>

# Append to a document
gog docs append <doc-id> --content "\n## Action Items\n- Item 1"

AI Agent Integration

The most powerful use case for gog is integration with AI agents. Here is an example of how this works with Claude Code:

Add the following to your CLAUDE.md:

## Available Tools

You have access to Google Workspace through the `gog` command:
- `gog gmail` — read and send emails
- `gog calendar` — view and create calendar events
- `gog drive` — access Google Drive files
- `gog docs` — create and edit Google Docs

Use these when the user asks about their emails, calendar, or files.

Once configured, Claude Code can execute gog commands directly:

User: "What meetings do I have tomorrow?"
Claude Code: [runs `gog calendar list --date 2026-02-11`]

Automation Examples

Daily Digest

A shell script that generates a morning summary:

#!/bin/bash
echo "## Daily Digest - $(date +%Y-%m-%d)"
echo ""
echo "### Unread Emails"
gog gmail list --unread --format=summary | head -10
echo ""
echo "### Today's Calendar"
gog calendar list --today

Scheduled Email Summary

Using cron to send a weekly email summary:

# Run every Friday at 5 PM
0 17 * * 5 /usr/local/bin/gog gmail list --from "$(date -d '7 days ago' +%Y-%m-%d)" --format=json | python3 summarize.py | gog gmail send --to "me@company.com" --subject "Weekly Email Summary"

Security Notes

gog stores OAuth tokens locally in ~/.gog/credentials.json. Protect this file:

chmod 600 ~/.gog/credentials.json

Review what permissions you granted during setup and revoke access you do not need through your Google Account settings at myaccount.google.com/permissions.

For enterprise use, consider whether storing credentials on individual developer machines is appropriate for your security policy, or whether a service account with scoped permissions is more appropriate.


How well do you understand AI?

Take our free 5-minute assessment covering 7 areas from AI comprehension to security awareness.

Share this article if you found it useful

シェア

Newsletter

Get the latest AI and DX insights delivered weekly

Your email will only be used for newsletter delivery.

無料診断ツール

あなたのAIリテラシー、診断してみませんか?

5分で分かるAIリテラシー診断。活用レベルからセキュリティ意識まで、7つの観点で評価します。

Learn More About テックトレンド

Discover the features and case studies for テックトレンド.

Related Articles