| name | aio-google-workspace |
| description | Interact with Google Workspace services via the gws CLI. Use when the user wants to send email, read Gmail, upload to Drive, create a Google Calendar event, read or write Google Sheets, generate a standup report, manage Google Tasks, or work with Google Docs, Slides, Chat, or Contacts.
|
| when_to_use | send email, upload to drive, create event, read spreadsheet, standup report, gws, google workspace, gmail, google drive, google calendar, google sheets, google docs, google tasks |
| argument-hint | [gmail | drive | calendar | sheets | docs | tasks] [action] |
| effort | low |
Google Workspace (gws CLI)
Environment
- gws: !
which gws 2>/dev/null || echo "NOT INSTALLED"
- gws auth: !
gws auth status 2>/dev/null || echo "NOT AUTHENTICATED — run: gws auth login"
Interact with Google Workspace services using the gws CLI tool.
Prerequisites
gws CLI must be installed and authenticated
- If auth errors occur, run:
gws auth login
General Syntax
gws <service> <resource> <method> --params '<JSON>'
gws <service> +<helper> [args]
gws schema <service.resource.method>
Common Flags
| Flag | Description |
|---|
--params '<JSON>' | URL/query parameters |
--json '<JSON>' | Request body (POST/PATCH/PUT) |
--upload <PATH> | Upload file as media content |
--output <PATH> | Save binary response to file |
--format <FMT> | Output: json (default), table, yaml, csv |
--page-all | Auto-paginate (NDJSON output) |
--page-limit <N> | Max pages (default: 10) |
--dry-run | Validate without sending |
Gmail
Helpers (preferred for common tasks)
gws gmail +send --params '{"to": "user@example.com", "subject": "Hello", "body": "Message body"}'
gws gmail +triage
gws gmail +watch
Direct API
gws gmail users messages list --params '{"userId": "me", "maxResults": 10}'
gws gmail users messages list --params '{"userId": "me", "q": "from:boss@company.com is:unread"}'
gws gmail users messages get --params '{"userId": "me", "id": "MESSAGE_ID"}'
gws gmail users messages list --params '{"userId": "me", "q": "subject:invoice after:2025/01/01"}'
gws gmail users labels list --params '{"userId": "me"}'
gws gmail users messages modify --params '{"userId": "me", "id": "MSG_ID"}' --json '{"removeLabelIds": ["INBOX"]}'
gws gmail users threads list --params '{"userId": "me", "maxResults": 5}'
gws gmail users threads get --params '{"userId": "me", "id": "THREAD_ID"}'
Google Drive
Helpers
gws drive +upload --params '{"name": "report.pdf", "parent": "FOLDER_ID"}' --upload ./report.pdf
Direct API
gws drive files list --params '{"pageSize": 10, "orderBy": "modifiedTime desc"}'
gws drive files list --params '{"pageSize": 10, "fields": "files(id,name,mimeType,modifiedTime,size)"}'
gws drive files list --params '{"q": "name contains '\''report'\''", "pageSize": 10}'
gws drive files list --params '{"q": "mimeType='\''application/pdf'\''", "pageSize": 10}'
gws drive files list --params '{"q": "'\''FOLDER_ID'\'' in parents", "pageSize": 20}'
gws drive files get --params '{"fileId": "FILE_ID"}'
gws drive files get --params '{"fileId": "FILE_ID", "alt": "media"}' --output ./downloaded-file
gws drive files export --params '{"fileId": "FILE_ID", "mimeType": "application/pdf"}' --output ./doc.pdf
gws drive files create --json '{"name": "New Folder", "mimeType": "application/vnd.google-apps.folder"}'
gws drive files update --params '{"fileId": "FILE_ID", "addParents": "FOLDER_ID", "removeParents": "OLD_PARENT_ID"}'
gws drive permissions create --params '{"fileId": "FILE_ID"}' --json '{"role": "reader", "type": "anyone"}'
gws drive permissions create --params '{"fileId": "FILE_ID"}' --json '{"role": "writer", "type": "user", "emailAddress": "user@example.com"}'
gws drive files delete --params '{"fileId": "FILE_ID"}'
gws drive files list --params '{"q": "fullText contains '\''quarterly report'\''", "includeItemsFromAllDrives": true, "supportsAllDrives": true}'
Google Calendar
Helpers
gws calendar +agenda
gws calendar +insert --params '{"summary": "Team Standup", "start": "2025-03-20T09:00:00", "end": "2025-03-20T09:30:00"}'
Direct API
gws calendar events list --params '{"calendarId": "primary", "timeMin": "2025-03-17T00:00:00Z", "maxResults": 10, "singleEvents": true, "orderBy": "startTime"}'
gws calendar events get --params '{"calendarId": "primary", "eventId": "EVENT_ID"}'
gws calendar events insert --params '{"calendarId": "primary"}' --json '{
"summary": "Project Review",
"start": {"dateTime": "2025-03-20T14:00:00", "timeZone": "Asia/Ho_Chi_Minh"},
"end": {"dateTime": "2025-03-20T15:00:00", "timeZone": "Asia/Ho_Chi_Minh"},
"attendees": [{"email": "user@example.com"}]
}'
gws calendar events patch --params '{"calendarId": "primary", "eventId": "EVENT_ID"}' --json '{"summary": "Updated Title"}'
gws calendar events delete --params '{"calendarId": "primary", "eventId": "EVENT_ID"}'
gws calendar calendarList list
gws calendar freebusy query --json '{
"timeMin": "2025-03-20T00:00:00Z",
"timeMax": "2025-03-21T00:00:00Z",
"items": [{"id": "primary"}]
}'
Google Sheets
Helpers
gws sheets +read --params '{"spreadsheetId": "SHEET_ID", "range": "Sheet1!A1:D10"}'
gws sheets +append --params '{"spreadsheetId": "SHEET_ID", "range": "Sheet1!A:D"}' --json '{"values": [["value1", "value2", "value3", "value4"]]}'
Direct API
gws sheets spreadsheets get --params '{"spreadsheetId": "SHEET_ID"}'
gws sheets spreadsheets values get --params '{"spreadsheetId": "SHEET_ID", "range": "Sheet1!A1:E20"}'
gws sheets spreadsheets values update --params '{"spreadsheetId": "SHEET_ID", "range": "Sheet1!A1", "valueInputOption": "USER_ENTERED"}' --json '{"values": [["Name", "Score"], ["Alice", 95], ["Bob", 87]]}'
gws sheets spreadsheets values batchGet --params '{"spreadsheetId": "SHEET_ID", "ranges": ["Sheet1!A:B", "Sheet2!A:C"]}'
gws sheets spreadsheets create --json '{"properties": {"title": "New Spreadsheet"}}'
gws sheets spreadsheets values clear --params '{"spreadsheetId": "SHEET_ID", "range": "Sheet1!A1:Z100"}'
Google Tasks
gws tasks tasklists list
gws tasks tasks list --params '{"tasklist": "TASKLIST_ID"}'
gws tasks tasks insert --params '{"tasklist": "TASKLIST_ID"}' --json '{"title": "Review PR", "notes": "Check the auth changes", "due": "2025-03-20T00:00:00Z"}'
gws tasks tasks patch --params '{"tasklist": "TASKLIST_ID", "task": "TASK_ID"}' --json '{"status": "completed"}'
gws tasks tasks delete --params '{"tasklist": "TASKLIST_ID", "task": "TASK_ID"}'
gws tasks tasklists insert --json '{"title": "Sprint 42"}'
Google Docs
gws docs documents get --params '{"documentId": "DOC_ID"}'
gws docs documents create --json '{"title": "Meeting Notes"}'
gws docs documents batchUpdate --params '{"documentId": "DOC_ID"}' --json '{
"requests": [{"insertText": {"location": {"index": 1}, "text": "Hello World\n"}}]
}'
Google Slides
gws slides presentations get --params '{"presentationId": "PRES_ID"}'
gws slides presentations create --json '{"title": "Q1 Review"}'
gws slides presentations pages get --params '{"presentationId": "PRES_ID", "pageObjectId": "PAGE_ID"}'
Google Chat
gws chat spaces list
gws chat spaces messages create --params '{"parent": "spaces/SPACE_ID"}' --json '{"text": "Hello team!"}'
gws chat spaces messages list --params '{"parent": "spaces/SPACE_ID", "pageSize": 10}'
Google People (Contacts)
gws people people connections list --params '{"resourceName": "people/me", "personFields": "names,emailAddresses,phoneNumbers", "pageSize": 20}'
gws people people searchContacts --params '{"query": "John", "readMask": "names,emailAddresses"}'
Cross-Service Workflows
gws workflow +standup-report
gws workflow +meeting-prep
gws workflow +email-to-task --params '{"messageId": "MSG_ID"}'
gws workflow +weekly-digest
gws workflow +file-announce --params '{"fileId": "FILE_ID", "spaceId": "SPACE_ID"}'
Schema Discovery
Use gws schema to explore any API method's parameters:
gws schema drive.files.list
gws schema gmail.users.messages.list
gws schema calendar.events.insert
gws schema calendar.events.insert --resolve-refs
Pagination
For large result sets:
gws drive files list --params '{"pageSize": 100}' --page-all
gws drive files list --params '{"pageSize": 100}' --page-all --page-limit 5
gws gmail users messages list --params '{"userId": "me"}' --page-all --page-delay 200
Output Formats
gws drive files list --params '{"pageSize": 5}' --format table
gws drive files list --params '{"pageSize": 100}' --format csv
gws calendar events list --params '{"calendarId": "primary", "maxResults": 5}' --format yaml
Common Patterns
Find a file then share it
gws drive files list --params '{"q": "name = '\''Budget 2025'\''"}' --format table
gws drive permissions create --params '{"fileId": "FILE_ID"}' --json '{"role": "writer", "type": "user", "emailAddress": "team@company.com"}'
Check inbox then reply
gws gmail +triage
gws gmail users messages get --params '{"userId": "me", "id": "MSG_ID"}'
gws gmail +send --params '{"to": "sender@example.com", "subject": "Re: Original Subject", "body": "Thanks for the update.", "threadId": "THREAD_ID"}'
Morning productivity check
gws gmail +triage
gws calendar +agenda
gws workflow +standup-report
Errors
| Error | Fix |
|---|
401 Unauthorized | Run gws auth login to re-authenticate |
403 Forbidden | Check scopes — may need broader OAuth consent |
404 Not Found | Verify resource ID (fileId, eventId, etc.) |
429 Rate Limit | Use --page-delay for bulk operations |