Use gog for Gmail/Calendar/Drive/Contacts/Sheets/Docs. Requires OAuth setup.
Setup (once)
gog auth credentials /path/to/client_secret.json
gog auth add you@gmail.com --services gmail,calendar,drive,contacts,sheets,docs
gog auth list
Common commands
gog gmail search 'newer_than:7d' --max 10
gog gmail send --to a@b.com --subject "Hi" --body "Hello"
gog calendar events --from --to
gog drive search "query" --max 10
gog contacts list --max 20
gog sheets get "Tab!A1:D10" --json
gog sheets update "Tab!A1:B2" --values-json '[["A","B"],["1","2"]]' --input USER_ENTERED
gog sheets append "Tab!A:C" --values-json '[["x","y","z"]]' --insert INSERT_ROWS
gog sheets clear "Tab!A2:Z"
gog sheets metadata --json
gog docs export --format txt --out /tmp/doc.txt
gog docs cat
Notes
GOG_ACCOUNT=you@gmail.com to avoid repeating --account.
--json plus --no-input.
--values-json (recommended) or as inline rows.
共 1 个版本