The gws binary must be on $PATH. See the project README for install options.
# Browser-based OAuth (interactive)
gws auth login
# Service Account
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.json
| Flag | Description |
|---|---|
| ------ | ------------- |
--format | Output format: json (default), table, yaml, csv |
--dry-run | Validate locally without calling the API |
--sanitize | Screen responses through Model Armor |
gws <service> <resource> [sub-resource] <method> [flags]
| Flag | Description |
|---|---|
| ------ | ------------- |
--params '{"key": "val"}' | URL/query parameters |
--json '{"key": "val"}' | Request body |
-o, --output | Save binary responses to file |
--upload | Upload file content (multipart) |
--page-all | Auto-paginate (NDJSON output) |
--page-limit | Max pages when using --page-all (default: 10) |
--page-delay | Delay between pages in ms (default: 100) |
--dry-run for destructive operations--sanitize for PII/content safety screening! expansion: Sheet ranges like Sheet1!A1 contain ! which zsh interprets as history expansion. Use double quotes with escaped inner quotes instead of single quotes:```bash
# WRONG (zsh will mangle the !)
gws sheets +read --spreadsheet ID --range 'Sheet1!A1:D10'
# CORRECT
gws sheets +read --spreadsheet ID --range "Sheet1!A1:D10"
```
--params and --json values in single quotes so the shell does not interpret the inner double quotes:```bash
gws drive files list --params '{"pageSize": 5}'
```
https://github.com/googleworkspace/clihttps://github.com/googleworkspace/cli/issues共 4 个版本