GoG Skill - Google Workspace操作をCLIで実現するClawdbotスキル
Clawdbot向けGoG Skillを利用して、Gmail、Calendar、Drive、Contacts、Sheets、DocsをコマンドラインからOAuth認証で操作する方法を解説します。
概要
GoG Skillは、Clawdbotフレームワーク内でGoogle Workspaceの各種サービス(Gmail、Calendar、Drive、Contacts、Sheets、Docs)をコマンドラインから操作するためのスキルである。gog CLIツールを利用し、OAuth 2.0認証を通じて安全にアクセスする。
本スキルは、Google公式APIを利用しつつ、コマンドラインインターフェースで効率的な操作を実現する。メール送信、カレンダーイベント作成、スプレッドシート更新等、日常的なワークフローを自動化できる。
公式サイトは https://gogcli.sh で公開されている。
技術的背景
Google Workspaceの公式APIは強力だが、各サービスごとに異なるクライアントライブラリとAPIエンドポイントが存在し、学習コストが高い。GoGはこれらを統一インターフェースで提供し、認証情報の一元管理とシンプルなコマンド体系を実現する。
提供される主要機能は以下の通り:
- Gmail: 検索、送信、下書き、返信、スレッド・メッセージ検索
- Calendar: イベント一覧、作成、更新、カラー設定
- Drive: ファイル検索
- Contacts: 連絡先一覧
- Sheets: データ取得、更新、追加、クリア、メタデータ取得
- Docs: エクスポート、テキスト表示、コピー
技術的仕様
システム要件
- macOS(Homebrewインストール経由)
- Google Workspaceアカウント
- OAuth 2.0クライアント認証情報(Google Cloud Consoleで取得)
インストール方法
Homebrew経由:
brew install steipete/tap/gogcli
初期設定
1. OAuth認証情報の登録:
Google Cloud Console(https://console.cloud.google.com/)で、OAuth 2.0クライアントIDを作成し、client_secret.jsonをダウンロード。
gog auth credentials /path/to/client_secret.json
2. アカウント追加とサービス認証:
gog auth add you@gmail.com --services gmail,calendar,drive,contacts,docs,sheets
ブラウザが開き、Googleログイン画面が表示される。各サービスへのアクセス許可を承認。
3. 認証状態確認:
gog auth list
環境変数設定(オプション)
デフォルトアカウントを設定することで、--accountフラグを省略可能:
export GOG_ACCOUNT=you@gmail.com
主要機能
Gmail操作
メール検索(スレッド単位):
gog gmail search 'newer_than:7d' --max 10
メール検索(メッセージ単位):
gog gmail messages search "in:inbox from:ryanair.com" --max 20 --account you@example.com
searchはスレッド(会話)単位、messages searchは個別メール単位で結果を返す。
メール送信(プレーンテキスト):
gog gmail send --to recipient@example.com --subject "Hi" --body "Hello"
メール送信(複数行、ファイル経由):
gog gmail send --to recipient@example.com --subject "Meeting Follow-up" --body-file ./message.txt
メール送信(標準入力):
gog gmail send --to recipient@example.com --subject "Hi" --body-file - <<'EOF'
Hi Name,
Thanks for meeting today. Next steps:
- Item one
- Item two
Best regards,
Your Name
EOF
HTML形式メール送信:
gog gmail send --to recipient@example.com \
--subject "Meeting Follow-up" \
--body-html "<p>Hi Name,</p><p>Thanks for meeting today.</p><ul><li>Item one</li><li>Item two</li></ul>"
下書き作成:
gog gmail drafts create --to recipient@example.com --subject "Hi" --body-file ./message.txt
下書き送信:
gog gmail drafts send <draftId>
返信:
gog gmail send --to recipient@example.com --subject "Re: Hi" --body "Reply" --reply-to-message-id <msgId>
Calendar操作
イベント一覧取得:
gog calendar events <calendarId> --from 2026-02-15T00:00:00Z --to 2026-02-22T23:59:59Z
イベント作成:
gog calendar create <calendarId> \
--summary "Team Meeting" \
--from 2026-02-20T10:00:00Z \
--to 2026-02-20T11:00:00Z
イベント作成(カラー付き):
gog calendar create <calendarId> \
--summary "Important Deadline" \
--from 2026-02-25T17:00:00Z \
--to 2026-02-25T18:00:00Z \
--event-color 11
イベント更新:
gog calendar update <calendarId> <eventId> \
--summary "Team Meeting (Rescheduled)" \
--event-color 4
利用可能カラー一覧:
gog calendar colors
カラーID一覧(1〜11):
- 1: #a4bdfc(薄青)
- 2: #7ae7bf(薄緑)
- 3: #dbadff(薄紫)
- 4: #ff887c(薄赤)
- 5: #fbd75b(黄)
- 6: #ffb878(オレンジ)
- 7: #46d6db(シアン)
- 8: #e1e1e1(グレー)
- 9: #5484ed(青)
- 10: #51b749(緑)
- 11: #dc2127(赤)
Drive操作
ファイル検索:
gog drive search "name contains 'Report'" --max 10
Contacts操作
連絡先一覧:
gog contacts list --max 20
Sheets操作
データ取得:
gog sheets get <sheetId> "Sheet1!A1:D10" --json
データ更新:
gog sheets update <sheetId> "Sheet1!A1:B2" \
--values-json '[["Header1","Header2"],["Value1","Value2"]]' \
--input USER_ENTERED
データ追加(行追加):
gog sheets append <sheetId> "Sheet1!A:C" \
--values-json '[["x","y","z"]]' \
--insert INSERT_ROWS
データクリア:
gog sheets clear <sheetId> "Sheet1!A2:Z"
メタデータ取得:
gog sheets metadata <sheetId> --json
Docs操作
ドキュメントエクスポート(テキスト形式):
gog docs export <docId> --format txt --out /tmp/doc.txt
ドキュメント内容表示:
gog docs cat <docId>
実装例
例1: 毎朝の未読メール通知
#!/bin/bash
# 未読メールを検索してSlack通知
UNREAD=$(gog gmail search 'is:unread' --max 10 --json | jq length)
if [ "$UNREAD" -gt 0 ]; then
curl -X POST https://hooks.slack.com/services/YOUR/WEBHOOK/URL \
-H 'Content-Type: application/json' \
-d "{\"text\":\"You have $UNREAD unread emails.\"}"
fi
例2: カレンダーイベント自動作成(CSV読み込み)
#!/bin/bash
# CSV形式のイベント一覧からカレンダーイベント作成
# CSV形式: summary,start,end,color
while IFS=, read -r summary start end color; do
gog calendar create primary \
--summary "$summary" \
--from "$start" \
--to "$end" \
--event-color "$color"
done < events.csv
例3: スプレッドシート自動更新(日次レポート)
#!/bin/bash
# 日次統計をスプレッドシートに追加
DATE=$(date +%Y-%m-%d)
SALES=$(curl -s https://api.example.com/sales | jq .total)
USERS=$(curl -s https://api.example.com/users | jq .count)
gog sheets append "1A2B3C4D5E6F7G8H9I" "DailyReport!A:C" \
--values-json "[\"$DATE\",$SALES,$USERS]" \
--insert INSERT_ROWS
例4: メール自動返信(不在通知)
#!/bin/bash
# 特定キーワードを含むメールに自動返信
gog gmail messages search "in:inbox subject:(vacation OR leave)" --max 5 --json | \
jq -r '.[].id' | \
while read -r msgId; do
gog gmail send \
--to sender@example.com \
--subject "Re: Out of Office" \
--body "I'm currently out of office. Will respond after Feb 25." \
--reply-to-message-id "$msgId"
done
例5: ドキュメントバックアップ
#!/bin/bash
# 全ドキュメントをテキスト形式でエクスポート
mkdir -p ~/backup/docs
gog drive search "mimeType='application/vnd.google-apps.document'" --json | \
jq -r '.[] | "\(.id) \(.name)"' | \
while read -r docId docName; do
gog docs export "$docId" --format txt --out "~/backup/docs/${docName}.txt"
done
ユースケース
ビジネスワークフローの自動化
日次レポートの自動生成(Sheetsへの統計追加)、定期メール送信(顧客へのニュースレター)、カレンダーイベントの一括作成(会議スケジュール管理)等を自動化。
メール管理の効率化
特定条件のメール(特定送信者、キーワード含む)を検索し、自動分類・返信・アーカイブ。メールボックスの整理を自動化。
データ連携
外部APIから取得したデータをGoogle Sheetsに自動記録。Salesforce、HubSpot等のCRMデータと連携し、レポート作成を自動化。
バックアップとアーカイブ
Google DocsやDriveのファイルを定期的にローカルまたは外部ストレージにエクスポート。データ損失リスクの軽減。
制限事項・セキュリティ考慮事項
OAuth認証の必要性
GoGは、Google公式APIを利用するため、OAuth 2.0クライアント認証情報が必須。Google Cloud Consoleでプロジェクトを作成し、認証情報を取得する必要がある。
APIクォータ制限
Google Workspace APIには、1日あたりのリクエスト数上限(Gmail: 1,000,000,000クォータユニット/日、Calendar: 1,000,000リクエスト/日等)が存在する。大量操作時は、APIクォータ超過に注意。
メール送信の注意事項
HTMLメール送信時は、<script>タグやインラインJavaScriptは無効化される。スタイルは<style>タグまたはインラインCSSで指定。
改行処理は、--bodyフラグでは\nが自動展開されない。複数行メールは--body-fileまたは標準入力(--body-file -)を使用。
スプレッドシート更新の型指定
--input USER_ENTEREDを指定すると、Googleが自動的に型を推定(数値、日付等)。RAWを指定すると、すべて文字列として扱われる。
カレンダーID取得
カレンダーIDは、Googleカレンダー設定画面の「カレンダーの統合」セクションで確認可能。プライマリカレンダーのIDは通常、Gmailアドレスと同一。
認証情報の管理
OAuth認証情報(client_secret.json)とアクセストークンは、環境変数または安全なディレクトリ(~/.config/gog/等)で管理。公開リポジトリへのコミット禁止。
参考リンク
- 公式サイト: https://gogcli.sh
- GitHub: https://github.com/steipete/gogcli(推定)
- Homebrew: https://github.com/steipete/homebrew-tap
- Google Cloud Console: https://console.cloud.google.com/
- Gmail API: https://developers.google.com/gmail/api
- Calendar API: https://developers.google.com/calendar/api
- Google Sheets API: https://developers.google.com/sheets/api
- Google Drive API: https://developers.google.com/drive/api
本記事の情報は2026年2月15日時点のものです。GoG Skillの機能、コマンド仕様、認証方法は変更される可能性があります。最新情報は公式サイト(https://gogcli.sh)をご確認ください。OAuth認証情報の取り扱いには十分注意し、Google Workspace APIの利用規約を遵守してください。
Related Articles
OpenClaw Skills Ranking February 2026: Planning Skills and Security Suite Dominate Top 10
GitHub OpenClaw skills ranking shows awesome-openclaw-skills (16,139 stars), Manus-style planning implementation planning-with-files (14,000 stars), and Obsidian integration (9,998 stars) claiming top 3 positions.
OpenClaw v2026.2.17: Claude Sonnet 4.6 Support, 1M Context, Slack/Telegram Enhancements
OpenClaw releases major update with Claude Sonnet 4.6 and 1M context window support, Slack native streaming, Telegram inline button styles, iOS Share Extension, and critical security fixes (OC-09) among 100+ changes.
Cursor CLI Update: Plan Handoff to Cloud, Mermaid ASCII Diagrams, and Quality-of-Life Improvements
Cursor updates its CLI with plan-to-cloud handoff from the terminal, inline ASCII rendering of Mermaid diagrams, and a range of tooling and reliability improvements.
Popular Articles
Claude Code v2.1.93 Released - Deferred Permission Decisions, Flicker-Free Rendering, and More
Anthropic releases Claude Code v2.1.93 with deferred permission decisions for PreToolUse hooks, flicker-free rendering option, PermissionDenied hook, and named subagent typeahead support.
Claude Code v2.1.92 Released - forceRemoteSettingsRefresh, Bedrock Setup Wizard, and More
Anthropic releases Claude Code v2.1.92 with forceRemoteSettingsRefresh policy setting, AWS Bedrock setup wizard, /cost command improvements, and numerous bug fixes.
Claude Code v2.1.84 Release - PowerShell Tool Preview and Environment Configuration Enhancements
Claude Code v2.1.84 introduces PowerShell tool for Windows, new environment variable overrides for model selection, idle session handling improvements, and various stability fixes.
Latest Articles
Claude Code v2.1.93 Released - Deferred Permission Decisions, Flicker-Free Rendering, and More
Anthropic releases Claude Code v2.1.93 with deferred permission decisions for PreToolUse hooks, flicker-free rendering option, PermissionDenied hook, and named subagent typeahead support.
Claude Code v2.1.92 Released - forceRemoteSettingsRefresh, Bedrock Setup Wizard, and More
Anthropic releases Claude Code v2.1.92 with forceRemoteSettingsRefresh policy setting, AWS Bedrock setup wizard, /cost command improvements, and numerous bug fixes.
Claude Code v2.1.91 Released - MCP Tool Result Persistence and Improved Edit Tool
Claude Code v2.1.91 introduces MCP tool result persistence override, improved shell execution controls, and enhanced Edit tool efficiency.