gog
Google Workspace CLI for Gmail, Calendar, Drive, Contacts, Sheets, and Docs.
Quand l'utiliser (Trigger)
Déclenchement standard selon le contexte de l'écosystème Hermès.
Mode d'emploi (Usage)
Mode d'emploi standard via l'agent Hermès. gog
Use gog for Gmail/Calendar/Drive/Contacts/Sheets/Docs. Uses OAuth Device Flow method.
Setup (if needed)
- System already configured with OAuth Device Flow
- Token location:
/home/bf/.config/gspread/token.json - Client secret:
/home/bf/.config/gspread/device_client_secret.json - Check status:
gog status - Reconfigure if needed:
gog auth
Common commands
-
Status check:
gog status -
Version:
gog --version -
Google Sheets (custom implementation):
gog sheets update 'Action' 'Details' [Category] [Status]'- Note: This is a custom wrapper for logging to Google Sheets - different from standard gog commands
-
Gmail search:
gog gmail search 'newer_than:7d' --max 10 -
Gmail send:
gog gmail send --to a@b.com --subject "Hi" --body "Hello" -
Calendar:
gog calendar events <calendarId> --from <iso> --to <iso> -
Drive search:
gog drive search "query" --max 10 -
Contacts:
gog contacts list --max 20 -
Sheets get:
gog sheets get <sheetId> "Tab!A1:D10" --json -
Sheets update:
gog sheets update <sheetId> "Tab!A1:B2" --values-json '[["A","B"],["1","2"]]' --input USER_ENTERED -
Sheets append:
gog sheets append <sheetId> "Tab!A:C" --values-json '[["x","y","z"]]' --insert INSERT_ROWS -
Sheets clear:
gog sheets clear <sheetId> "Tab!A2:Z" -
Sheets metadata:
gog sheets metadata <sheetId> --json -
Docs export:
gog docs export <docId> --format txt --out /tmp/doc.txt -
Docs cat:
gog docs cat <docId>
Notes
- Set
GOG_ACCOUNT=you@gmail.comto avoid repeating--account. - For scripting, prefer
--jsonplus--no-input. - Sheets values can be passed via
--values-json(recommended) or as inline rows. - Docs supports export/cat/copy. In-place edits require a Docs API client (not in gog).
- Confirm before sending mail or creating events.
- Current Setup: Uses OAuth Device Flow method
- Token Location:
/home/bf/.config/gspread/token.json - Custom Script: Available at
/home/bf/openclaw-workspace/scripts/log-change-sheets.py(aussi dansdevops/sysguard/scripts/log-change-sheets.py). Utilise REST API directe — pas de Service Account nécessaire. - OAuth fix (2026-05-26) : Le script a été réécrit pour utiliser l’API REST Google Sheets directement (via
requests) au lieu degspread. Le token Device Flow n’a que le scopespreadsheets— le script litclient_id/client_secretdepuisdevice_client_secret.jsonà chaque refresh. Voirdevops/sysguardpour les détails. - Shared Sheet: ID
1U-GaOz6qmQaBP8NRwwRlVqY67wT_a1O7cA8dp60GGYs— Sheet actif avec 4 onglets (Guide, Commandes, Fichiers, Logs).
References
references/gog-session-discovery.md— Session-specific implementation details and troubleshootingreferences/oauth-device-flow-logger.md— Guide complet: configuration OAuth Device Flow, script REST API logger, dépannage token, reproduction sur nouveau VPS