google-docs-manager
SKILL.md
Google Docs Manager
Manage Google Docs via Service Account — no browser interaction required, fully automatable.
Prerequisites
- Google Cloud project with Docs API + Drive API enabled
- Service Account JSON key file
- Set
GOOGLE_CREDENTIALS_PATH=/path/to/credentials.json - Install:
pip install -r requirements.txt
When to Use
- User says: "create a doc", "write a document", "find doc", "read doc content", "append/insert/replace text in doc", "delete document"
- Agent needs to read or modify Google Docs content programmatically
- Not for downloading binary files or managing non-Doc files (use google-drive-manager instead)
Quick Reference
| Task | Command |
|---|---|
| Create doc | python scripts/docs.py create "Title" [--content "text"] |
| Find docs | python scripts/docs.py find "query" [--limit 10] |
| Read content | python scripts/docs.py get-text <doc_id> |
| Append text | python scripts/docs.py append-text <doc_id> "text" |
| Insert at start | python scripts/docs.py insert-text <doc_id> "text" |
| Find & replace | python scripts/docs.py replace-text <doc_id> "old" "new" |
| Delete (trash) | python scripts/docs.py delete <doc_id> |
| Delete (permanent) | python scripts/docs.py delete <doc_id> --permanent |
Output Format
All commands return structured JSON:
{"status": "success", "message": "...", "data": {...}}
{"status": "error", "message": "..."}
Agent Rules
- Always check
statusfield before usingdata - Use
findbefore editing — never guess doc IDs - Use
get-textto read content before making targeted edits - Prefer
replace-textfor targeted changes; useappend-textfor additions - Default
deletemoves to trash — use--permanentonly when explicitly requested doc_idis the alphanumeric string in the Google Docs URL:https://docs.google.com/document/d/<doc_id>/edit
Chained Operation Pattern
# Find → read → edit workflow
python scripts/docs.py find "meeting notes"
# → extract doc_id from data.documents[0].id
python scripts/docs.py get-text <doc_id>
# → read current content
python scripts/docs.py replace-text <doc_id> "old section" "updated section"
# → targeted edit
Auth Management
python scripts/auth.py status # Check credentials file
python scripts/auth.py validate # Test API connectivity
Common Mistakes
| Mistake | Fix |
|---|---|
| Guessing doc_id | Always call find first to get exact doc_id |
| Editing without reading | Call get-text before replace-text to confirm content exists |
| Permanent delete by default | Keep --permanent off unless user explicitly says so |
| Using doc URL as doc_id | Extract only the alphanumeric ID from the URL, not the full URL |
| Appending when replace is needed | Use replace-text for targeted edits, append-text only for additions |
Weekly Installs
2
Repository
zhucl1006/googleskillsFirst Seen
Feb 27, 2026
Security Audits
Installed on
opencode2
gemini-cli2
antigravity2
claude-code2
github-copilot2
codex2