Loading...
Loading...
Create and modify Google Docs documents. Read document content and structure, manage formatting, paragraphs, and styles. Use when working with Google Docs document management.
npx skill4agent add odyssey4me/agent-skills google-docspip install --user google-auth google-auth-oauthlib google-api-python-client keyring pyyamlpython scripts/google-docs.py check~/.config/agent-skills/google.yamloauth_client:
client_id: your-client-id.apps.googleusercontent.com
client_secret: your-client-secretpython scripts/google-docs.py check| Scope | Permission | Used For |
|---|---|---|
| Read documents | Reading document content and metadata |
| Full access | Creating and modifying documents |
| Read Drive files | Exporting documents as markdown or PDF |
keyring del agent-skills google-docs-token-jsonpython scripts/google-docs.py checkpython scripts/google-docs.py checkpython scripts/google-docs.py auth setup \
--client-id YOUR_CLIENT_ID \
--client-secret YOUR_CLIENT_SECRET~/.config/agent-skills/google-docs.yaml--client-id--client-secretpython scripts/google-docs.py documents create --title "My Document"--title--json# Create a new document
python scripts/google-docs.py documents create --title "Project Notes"
# Output:
# ✓ Document created successfully
# Title: Project Notes
# Document ID: 1abc...xyz
# URL: https://docs.google.com/document/d/1abc...xyz/editpython scripts/google-docs.py documents get DOCUMENT_IDdocument_id--json# Get document metadata
python scripts/google-docs.py documents get 1abc...xyz
# Output:
# Title: Project Notes
# Document ID: 1abc...xyz
# Characters: 1234
# Revision ID: abc123python scripts/google-docs.py documents read DOCUMENT_IDdocument_id--formattextmarkdownpdf--output-o--json# Read as plain text (default)
python scripts/google-docs.py documents read 1abc...xyz
# Read as markdown with table preservation
python scripts/google-docs.py documents read 1abc...xyz --format markdown
# Export as PDF
python scripts/google-docs.py documents read 1abc...xyz --format pdf --output document.pdf
# Output as markdown:
# # Heading
#
# This is a paragraph.
#
# | Column 1 | Column 2 |
# |----------|----------|
# | Value 1 | Value 2 |drive.readonlypython scripts/google-docs.py content append DOCUMENT_ID --text "Additional content"document_id--text--json# Append text
python scripts/google-docs.py content append 1abc...xyz --text "Meeting notes from today..."
# Output:
# ✓ Text appended successfullypython scripts/google-docs.py content insert DOCUMENT_ID --text "Insert this" --index 10document_id--text--index--json# Insert text at the beginning (index 1, after title)
python scripts/google-docs.py content insert 1abc...xyz --text "Introduction\n\n" --index 1
# Output:
# ✓ Text inserted successfullypython scripts/google-docs.py content delete DOCUMENT_ID --start-index 10 --end-index 50document_id--start-index--end-index--json# Delete characters 10-50
python scripts/google-docs.py content delete 1abc...xyz --start-index 10 --end-index 50
# Output:
# ✓ Content deleted successfullypython scripts/google-docs.py formatting apply DOCUMENT_ID \
--start-index 1 --end-index 20 --bold --italicdocument_id--start-index--end-index--bold--italic--underline--font-size SIZE--json# Make title bold and larger
python scripts/google-docs.py formatting apply 1abc...xyz \
--start-index 1 --end-index 20 --bold --font-size 18
# Apply italic to a section
python scripts/google-docs.py formatting apply 1abc...xyz \
--start-index 50 --end-index 100 --italic
# Output:
# ✓ Formatting applied successfully# Create a new document
DOC_ID=$(python scripts/google-docs.py documents create --title "Weekly Report" --json | jq -r '.documentId')
# Add content
python scripts/google-docs.py content append $DOC_ID --text "Weekly Report\n\n"
python scripts/google-docs.py content append $DOC_ID --text "Summary: This week's accomplishments...\n"
# Format the title
python scripts/google-docs.py formatting apply $DOC_ID --start-index 1 --end-index 14 --bold --font-size 18
# Read it back
python scripts/google-docs.py documents read $DOC_ID# Get document info
python scripts/google-docs.py documents get 1abc...xyz
# Extract plain text
python scripts/google-docs.py documents read 1abc...xyz > document.txt
# Get full JSON structure
python scripts/google-docs.py documents get 1abc...xyz --json > document.json# Insert a new section
python scripts/google-docs.py content insert 1abc...xyz \
--text "\n\nNew Section\n" --index 100
# Format the new section header
python scripts/google-docs.py formatting apply 1abc...xyz \
--start-index 102 --end-index 113 --bold
# Append more content
python scripts/google-docs.py content append 1abc...xyz \
--text "Additional details about the new section..."keyring del agent-skills google-docs-token-jsonpython scripts/google-docs.py checkhttps://docs.google.com/document/d/1abc...xyz/edit1abc...xyzdocuments get --jsonpip install --user google-auth google-auth-oauthlib google-api-python-client keyring pyyamldocs.googleapis.com