Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Added

- Sites: add Drive-backed `sites` commands to list, search, inspect, and open New Google Sites. (#574) — thanks @thewilloftheshadow.
- Analytics/Search Console: add GA4 `analytics accounts|report` plus Search Console site, search analytics, and sitemap commands. (#402) — thanks @haresh-seenivasagan.
- Gmail: add `gmail send --body-html-file` for sending HTML email bodies from files without shell command substitution. (#575) — thanks @toruvieI.
- YouTube: add `youtube` (alias `yt`) command group for YouTube Data API v3 — list activities, videos, playlists, comment threads, and channels; API key via config `youtube_api_key` or `GOG_YOUTUBE_API_KEY`; OAuth for `--mine` with `gog auth add ... --services youtube`. (#313) — thanks @satputekuldip.
- Forms: add quiz grading flags to `forms add-question` so choice and short-answer questions can set answer keys and point values when created. (#570) — thanks @dbernaltbn.
Expand Down
27 changes: 22 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# gogcli

`gog` is a script-friendly Google CLI for Gmail, Calendar, Drive, Docs, Sheets,
Sites, Slides, Forms, Meet, Apps Script, Contacts, Tasks, People, Classroom, Chat,
YouTube, and Workspace admin flows.
Sites, Slides, Forms, Meet, Apps Script, Analytics, Search Console, Contacts,
Tasks, People, Classroom, Chat, YouTube, and Workspace admin flows.

It is built for terminals, shell scripts, CI, and coding agents:

Expand Down Expand Up @@ -82,16 +82,20 @@ Useful Google setup links:
- [OAuth consent screen](https://console.cloud.google.com/auth/branding)
- [API library](https://console.cloud.google.com/apis/library)
- [Places API (New)](https://console.cloud.google.com/apis/api/places.googleapis.com)
- [Google Analytics Admin API](https://console.cloud.google.com/apis/api/analyticsadmin.googleapis.com)
- [Google Analytics Data API](https://console.cloud.google.com/apis/api/analyticsdata.googleapis.com)
- [Google Search Console API](https://console.cloud.google.com/apis/api/searchconsole.googleapis.com)
- [YouTube Data API v3](https://console.cloud.google.com/apis/api/youtube.googleapis.com)
- [Apps Script user setting](https://script.google.com/home/usersettings)

Enable APIs in the same Cloud project that owns your OAuth client. If Google
returns `accessNotConfigured`, enable that API and retry after propagation.

Consumer `gmail.com` accounts work for normal user APIs such as Gmail, Calendar,
Drive, Docs, Sheets, Slides, Forms, Apps Script, Contacts/People, Tasks, and
Classroom. Workspace-only APIs such as Admin Directory, Cloud Identity Groups,
Chat, and Keep/domain-wide-delegation flows require a managed domain.
Drive, Docs, Sheets, Slides, Forms, Apps Script, Analytics, Search Console,
Contacts/People, Tasks, and Classroom. Workspace-only APIs such as Admin
Directory, Cloud Identity Groups, Chat, and Keep/domain-wide-delegation flows
require a managed domain.

If your OAuth app is External + Testing, Google refresh tokens for user-data
scopes can expire after 7 days. Publish the personal OAuth app if you want
Expand Down Expand Up @@ -204,6 +208,16 @@ gog yt videos list --chart mostPopular --region US --max 5
gog yt activities list --mine -a you@gmail.com
```

### Analytics and Search Console

```bash
gog analytics accounts --all --json
gog analytics report 123456789 --from 7daysAgo --to today --dimensions date,country --metrics activeUsers,sessions
gog searchconsole sites
gog searchconsole query sc-domain:example.com --from 2026-02-01 --to 2026-02-07 --dimensions query,page --filter query:contains:gog
gog searchconsole sitemaps submit sc-domain:example.com https://example.com/sitemap.xml --force
```

### Backup

```bash
Expand Down Expand Up @@ -326,6 +340,7 @@ accounts.
Common user services:

- Gmail, Calendar, Drive, Docs, Sheets, Slides, Forms, Meet, Apps Script
- Analytics and Search Console
- Contacts, People, Tasks, Classroom
- Chat for Workspace accounts
- Backup and local utility commands
Expand Down Expand Up @@ -357,6 +372,8 @@ Generated service scope table:
| sites | yes | Drive API | `https://www.googleapis.com/auth/drive` | New Google Sites are exposed as Drive files |
| meet | yes | Meet REST API | `https://www.googleapis.com/auth/meetings.space.created`<br>`https://www.googleapis.com/auth/meetings.space.readonly`<br>`https://www.googleapis.com/auth/meetings.space.settings` | |
| appscript | yes | Apps Script API | `https://www.googleapis.com/auth/script.projects`<br>`https://www.googleapis.com/auth/script.deployments`<br>`https://www.googleapis.com/auth/script.processes` | |
| analytics | yes | Analytics Admin API, Analytics Data API | `https://www.googleapis.com/auth/analytics.readonly` | GA4 account summaries + reporting |
| searchconsole | yes | Search Console API | `https://www.googleapis.com/auth/webmasters` | Search Analytics + sitemap management |
| ads | yes | Google Ads API | `https://www.googleapis.com/auth/adwords` | OAuth scope only |
| groups | no | Cloud Identity API | `https://www.googleapis.com/auth/cloud-identity.groups.readonly` | Workspace only |
| keep | no | Keep API | `https://www.googleapis.com/auth/keep` | Workspace only; service account (domain-wide delegation) |
Expand Down
17 changes: 16 additions & 1 deletion docs/commands.generated.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Generated from `gog schema --json`.

- [`gog <command> [flags]`](commands/gog.md) - Google CLI for Gmail/Calendar/Chat/Classroom/Drive/Contacts/Tasks/Sheets/Docs/Slides/People/Forms/Meet/App Script/Ads/Groups/Admin/Keep/YouTube
- [`gog <command> [flags]`](commands/gog.md) - Google CLI for Gmail/Calendar/Chat/Classroom/Drive/Contacts/Tasks/Sheets/Docs/Slides/People/Forms/Meet/App Script/Analytics/Search Console/Ads/Groups/Admin/Keep/YouTube
- [`gog admin <command> [flags]`](commands/gog-admin.md) - Google Workspace Admin (Directory API) - requires domain-wide delegation
- [`gog admin groups <command>`](commands/gog-admin-groups.md) - Manage Workspace groups
- [`gog admin groups list (ls) [flags]`](commands/gog-admin-groups-list.md) - List groups in a domain
Expand All @@ -17,6 +17,9 @@ Generated from `gog schema --json`.
- [`gog admin users suspend <userEmail>`](commands/gog-admin-users-suspend.md) - Suspend a user account
- [`gog agent <command> [flags]`](commands/gog-agent.md) - Agent-friendly helpers
- [`gog agent exit-codes (exitcodes,exit-code)`](commands/gog-agent-exit-codes.md) - Print stable exit codes for automation
- [`gog analytics (ga) <command> [flags]`](commands/gog-analytics.md) - Google Analytics
- [`gog analytics (ga) accounts (list,ls) [flags]`](commands/gog-analytics-accounts.md) - List GA4 account summaries
- [`gog analytics (ga) report <property> [flags]`](commands/gog-analytics-report.md) - Run a GA4 report (Analytics Data API)
- [`gog appscript (script,apps-script) <command> [flags]`](commands/gog-appscript.md) - Google Apps Script
- [`gog appscript (script,apps-script) content (cat) <scriptId>`](commands/gog-appscript-content.md) - Get Apps Script project content
- [`gog appscript (script,apps-script) create (new) --title=STRING [flags]`](commands/gog-appscript-create.md) - Create an Apps Script project
Expand Down Expand Up @@ -397,6 +400,18 @@ Generated from `gog schema --json`.
- [`gog people (person) search (find,query) <query> ... [flags]`](commands/gog-people-search.md) - Search the Workspace directory
- [`gog schema (help-json,helpjson) [<command> ...] [flags]`](commands/gog-schema.md) - Machine-readable command/flag schema
- [`gog search (find) <query> ... [flags]`](commands/gog-search.md) - Search Drive files (alias for 'drive search')
- [`gog searchconsole (gsc,search-console,webmasters) <command> [flags]`](commands/gog-searchconsole.md) - Google Search Console
- [`gog searchconsole (gsc,search-console,webmasters) query (report) <siteUrl> [flags]`](commands/gog-searchconsole-query.md) - Run a Search Analytics query
- [`gog searchconsole (gsc,search-console,webmasters) searchanalytics (analytics) <command>`](commands/gog-searchconsole-searchanalytics.md) - Search Analytics queries
- [`gog searchconsole (gsc,search-console,webmasters) searchanalytics (analytics) query (run) <siteUrl> [flags]`](commands/gog-searchconsole-searchanalytics-query.md) - Run a Search Analytics query
- [`gog searchconsole (gsc,search-console,webmasters) sitemaps <command>`](commands/gog-searchconsole-sitemaps.md) - List/get/submit/delete sitemaps
- [`gog searchconsole (gsc,search-console,webmasters) sitemaps delete (rm,remove) <siteUrl> <feedpath>`](commands/gog-searchconsole-sitemaps-delete.md) - Delete a sitemap
- [`gog searchconsole (gsc,search-console,webmasters) sitemaps get (info,show) <siteUrl> <feedpath>`](commands/gog-searchconsole-sitemaps-get.md) - Get a sitemap
- [`gog searchconsole (gsc,search-console,webmasters) sitemaps list (ls) <siteUrl> [flags]`](commands/gog-searchconsole-sitemaps-list.md) - List sitemaps for a site
- [`gog searchconsole (gsc,search-console,webmasters) sitemaps submit <siteUrl> <feedpath>`](commands/gog-searchconsole-sitemaps-submit.md) - Submit a sitemap
- [`gog searchconsole (gsc,search-console,webmasters) sites (list,ls) <command>`](commands/gog-searchconsole-sites.md) - List and inspect Search Console sites
- [`gog searchconsole (gsc,search-console,webmasters) sites (list,ls) get (info,show) <siteUrl>`](commands/gog-searchconsole-sites-get.md) - Get a specific Search Console site
- [`gog searchconsole (gsc,search-console,webmasters) sites (list,ls) list (ls) [flags]`](commands/gog-searchconsole-sites-list.md) - List accessible Search Console sites
- [`gog send [flags]`](commands/gog-send.md) - Send an email (alias for 'gmail send')
- [`gog sheets (sheet) <command> [flags]`](commands/gog-sheets.md) - Google Sheets
- [`gog sheets (sheet) add-tab (add-sheet) <spreadsheetId> <tabName> [flags]`](commands/gog-sheets-add-tab.md) - Add a new tab/sheet to a spreadsheet
Expand Down
21 changes: 19 additions & 2 deletions docs/commands/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

Every `gog` command has a generated docs page. The source of truth is the live CLI schema; run `make docs-commands` after changing command names, flags, help text, aliases, or arguments.

Generated pages: 501.
Generated pages: 516.

## Top-level Commands

- [gog admin](gog-admin.md) - Google Workspace Admin (Directory API) - requires domain-wide delegation
- [gog agent](gog-agent.md) - Agent-friendly helpers
- [gog analytics](gog-analytics.md) - Google Analytics
- [gog appscript](gog-appscript.md) - Google Apps Script
- [gog auth](gog-auth.md) - Auth and credentials
- [gog backup](gog-backup.md) - Encrypted Google account backups
Expand All @@ -34,6 +35,7 @@ Generated pages: 501.
- [gog people](gog-people.md) - Google People
- [gog schema](gog-schema.md) - Machine-readable command/flag schema
- [gog search](gog-search.md) - Search Drive files (alias for 'drive search')
- [gog searchconsole](gog-searchconsole.md) - Google Search Console
- [gog send](gog-send.md) - Send an email (alias for 'gmail send')
- [gog sheets](gog-sheets.md) - Google Sheets
- [gog sites](gog-sites.md) - Google Sites (Drive-backed)
Expand All @@ -48,7 +50,7 @@ Generated pages: 501.

## All Commands

- [gog](gog.md) - Google CLI for Gmail/Calendar/Chat/Classroom/Drive/Contacts/Tasks/Sheets/Docs/Slides/People/Forms/Meet/App Script/Ads/Groups/Admin/Keep/YouTube
- [gog](gog.md) - Google CLI for Gmail/Calendar/Chat/Classroom/Drive/Contacts/Tasks/Sheets/Docs/Slides/People/Forms/Meet/App Script/Analytics/Search Console/Ads/Groups/Admin/Keep/YouTube
- [gog admin](gog-admin.md) - Google Workspace Admin (Directory API) - requires domain-wide delegation
- [gog admin groups](gog-admin-groups.md) - Manage Workspace groups
- [gog admin groups list](gog-admin-groups-list.md) - List groups in a domain
Expand All @@ -63,6 +65,9 @@ Generated pages: 501.
- [gog admin users suspend](gog-admin-users-suspend.md) - Suspend a user account
- [gog agent](gog-agent.md) - Agent-friendly helpers
- [gog agent exit-codes](gog-agent-exit-codes.md) - Print stable exit codes for automation
- [gog analytics](gog-analytics.md) - Google Analytics
- [gog analytics accounts](gog-analytics-accounts.md) - List GA4 account summaries
- [gog analytics report](gog-analytics-report.md) - Run a GA4 report (Analytics Data API)
- [gog appscript](gog-appscript.md) - Google Apps Script
- [gog appscript content](gog-appscript-content.md) - Get Apps Script project content
- [gog appscript create](gog-appscript-create.md) - Create an Apps Script project
Expand Down Expand Up @@ -443,6 +448,18 @@ Generated pages: 501.
- [gog people search](gog-people-search.md) - Search the Workspace directory
- [gog schema](gog-schema.md) - Machine-readable command/flag schema
- [gog search](gog-search.md) - Search Drive files (alias for 'drive search')
- [gog searchconsole](gog-searchconsole.md) - Google Search Console
- [gog searchconsole query](gog-searchconsole-query.md) - Run a Search Analytics query
- [gog searchconsole searchanalytics](gog-searchconsole-searchanalytics.md) - Search Analytics queries
- [gog searchconsole searchanalytics query](gog-searchconsole-searchanalytics-query.md) - Run a Search Analytics query
- [gog searchconsole sitemaps](gog-searchconsole-sitemaps.md) - List/get/submit/delete sitemaps
- [gog searchconsole sitemaps delete](gog-searchconsole-sitemaps-delete.md) - Delete a sitemap
- [gog searchconsole sitemaps get](gog-searchconsole-sitemaps-get.md) - Get a sitemap
- [gog searchconsole sitemaps list](gog-searchconsole-sitemaps-list.md) - List sitemaps for a site
- [gog searchconsole sitemaps submit](gog-searchconsole-sitemaps-submit.md) - Submit a sitemap
- [gog searchconsole sites](gog-searchconsole-sites.md) - List and inspect Search Console sites
- [gog searchconsole sites get](gog-searchconsole-sites-get.md) - Get a specific Search Console site
- [gog searchconsole sites list](gog-searchconsole-sites-list.md) - List accessible Search Console sites
- [gog send](gog-send.md) - Send an email (alias for 'gmail send')
- [gog sheets](gog-sheets.md) - Google Sheets
- [gog sheets add-tab](gog-sheets-add-tab.md) - Add a new tab/sheet to a spreadsheet
Expand Down
2 changes: 1 addition & 1 deletion docs/commands/gog-admin-groups-list.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ gog admin groups list (ls) [flags]
| Flag | Type | Default | Help |
| --- | --- | --- | --- |
| `--access-token` | `string` | | Use provided access token directly (bypasses stored refresh tokens; token expires in ~1h) |
| `-a`<br>`--account`<br>`--acct` | `string` | | Account email for API commands (gmail/calendar/chat/classroom/drive/docs/slides/contacts/tasks/people/sheets/forms/sites/appscript/ads) |
| `-a`<br>`--account`<br>`--acct` | `string` | | Account email for API commands (gmail/calendar/chat/classroom/drive/docs/slides/contacts/tasks/people/sheets/forms/sites/appscript/analytics/searchconsole/ads) |
| `--all`<br>`--all-pages`<br>`--allpages` | `bool` | | Fetch all pages |
| `--client` | `string` | | OAuth client name (selects stored credentials + token bucket) |
| `--color` | `string` | auto | Color output: auto\|always\|never |
Expand Down
2 changes: 1 addition & 1 deletion docs/commands/gog-admin-groups-members-add.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ gog admin groups members add (invite) <groupEmail> <memberEmail> [flags]
| Flag | Type | Default | Help |
| --- | --- | --- | --- |
| `--access-token` | `string` | | Use provided access token directly (bypasses stored refresh tokens; token expires in ~1h) |
| `-a`<br>`--account`<br>`--acct` | `string` | | Account email for API commands (gmail/calendar/chat/classroom/drive/docs/slides/contacts/tasks/people/sheets/forms/sites/appscript/ads) |
| `-a`<br>`--account`<br>`--acct` | `string` | | Account email for API commands (gmail/calendar/chat/classroom/drive/docs/slides/contacts/tasks/people/sheets/forms/sites/appscript/analytics/searchconsole/ads) |
| `--client` | `string` | | OAuth client name (selects stored credentials + token bucket) |
| `--color` | `string` | auto | Color output: auto\|always\|never |
| `--disable-commands` | `string` | | Comma-separated list of disabled commands; dot paths allowed |
Expand Down
2 changes: 1 addition & 1 deletion docs/commands/gog-admin-groups-members-list.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ gog admin groups members list (ls) <groupEmail> [flags]
| Flag | Type | Default | Help |
| --- | --- | --- | --- |
| `--access-token` | `string` | | Use provided access token directly (bypasses stored refresh tokens; token expires in ~1h) |
| `-a`<br>`--account`<br>`--acct` | `string` | | Account email for API commands (gmail/calendar/chat/classroom/drive/docs/slides/contacts/tasks/people/sheets/forms/sites/appscript/ads) |
| `-a`<br>`--account`<br>`--acct` | `string` | | Account email for API commands (gmail/calendar/chat/classroom/drive/docs/slides/contacts/tasks/people/sheets/forms/sites/appscript/analytics/searchconsole/ads) |
| `--all`<br>`--all-pages`<br>`--allpages` | `bool` | | Fetch all pages |
| `--client` | `string` | | OAuth client name (selects stored credentials + token bucket) |
| `--color` | `string` | auto | Color output: auto\|always\|never |
Expand Down
2 changes: 1 addition & 1 deletion docs/commands/gog-admin-groups-members-remove.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ gog admin groups members remove (rm,del,delete) <groupEmail> <memberEmail>
| Flag | Type | Default | Help |
| --- | --- | --- | --- |
| `--access-token` | `string` | | Use provided access token directly (bypasses stored refresh tokens; token expires in ~1h) |
| `-a`<br>`--account`<br>`--acct` | `string` | | Account email for API commands (gmail/calendar/chat/classroom/drive/docs/slides/contacts/tasks/people/sheets/forms/sites/appscript/ads) |
| `-a`<br>`--account`<br>`--acct` | `string` | | Account email for API commands (gmail/calendar/chat/classroom/drive/docs/slides/contacts/tasks/people/sheets/forms/sites/appscript/analytics/searchconsole/ads) |
| `--client` | `string` | | OAuth client name (selects stored credentials + token bucket) |
| `--color` | `string` | auto | Color output: auto\|always\|never |
| `--disable-commands` | `string` | | Comma-separated list of disabled commands; dot paths allowed |
Expand Down
2 changes: 1 addition & 1 deletion docs/commands/gog-admin-groups-members.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ gog admin groups members <command>
| Flag | Type | Default | Help |
| --- | --- | --- | --- |
| `--access-token` | `string` | | Use provided access token directly (bypasses stored refresh tokens; token expires in ~1h) |
| `-a`<br>`--account`<br>`--acct` | `string` | | Account email for API commands (gmail/calendar/chat/classroom/drive/docs/slides/contacts/tasks/people/sheets/forms/sites/appscript/ads) |
| `-a`<br>`--account`<br>`--acct` | `string` | | Account email for API commands (gmail/calendar/chat/classroom/drive/docs/slides/contacts/tasks/people/sheets/forms/sites/appscript/analytics/searchconsole/ads) |
| `--client` | `string` | | OAuth client name (selects stored credentials + token bucket) |
| `--color` | `string` | auto | Color output: auto\|always\|never |
| `--disable-commands` | `string` | | Comma-separated list of disabled commands; dot paths allowed |
Expand Down
2 changes: 1 addition & 1 deletion docs/commands/gog-admin-groups.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ gog admin groups <command>
| Flag | Type | Default | Help |
| --- | --- | --- | --- |
| `--access-token` | `string` | | Use provided access token directly (bypasses stored refresh tokens; token expires in ~1h) |
| `-a`<br>`--account`<br>`--acct` | `string` | | Account email for API commands (gmail/calendar/chat/classroom/drive/docs/slides/contacts/tasks/people/sheets/forms/sites/appscript/ads) |
| `-a`<br>`--account`<br>`--acct` | `string` | | Account email for API commands (gmail/calendar/chat/classroom/drive/docs/slides/contacts/tasks/people/sheets/forms/sites/appscript/analytics/searchconsole/ads) |
| `--client` | `string` | | OAuth client name (selects stored credentials + token bucket) |
| `--color` | `string` | auto | Color output: auto\|always\|never |
| `--disable-commands` | `string` | | Comma-separated list of disabled commands; dot paths allowed |
Expand Down
Loading
Loading