Skip to main content
skill CX Codex

google-docs · acedatacloud — Claude Code skill: what it does, how to install

Reads, creates, and updates Google Docs documents using the Docs REST API via curl and jq.

Apache-2.0 175 installs ★ 17 updated 2026-10-25

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add AceDataCloud/Skills --skill google-docs -a claude-code
Open on GitHub

What google-docs does

This skill connects your coding assistant to the Google Docs v1 REST API using curl and jq. It extracts plain text by traversing document paragraph structures, initializes new documents directly in your Google Drive root, and pushes text updates through batchUpdate.

All calls require an OAuth bearer token passed via $GOOGLE_DOCS_TOKEN. The default configuration grants documents.readonly access. If your token lacks the full documents scope, write calls fail with a 403 PERMISSION_DENIED status.

The Docs API relies strictly on character-based indexing. Every text insertion alters subsequent positions, so multi-part edits must run back-to-front to avoid corrupting offsets.

What it helps with

  • extract plain text from a Google Doc via API
  • create new documents in Google Drive root
  • insert text blocks at precise index positions
  • replace placeholder tags across an entire document

Example prompts for the agent

  • Read the plain text from document DOC_ID
  • Create a new document titled "Release Notes"
  • Replace all occurrences of {{version}} with 1.0.0 in doc DOC_ID

How to install google-docs

1Skills CLI (Vercel)

npx skills add AceDataCloud/Skills --skill google-docs -a claude-code

2Manually: put the files in place

~/.claude/skills/google-docs/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/google-docs/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about google-docs

How to install google-docs in Claude Code?

Run npx skills add AceDataCloud/Skills --skill google-docs -a claude-code. The manifest installs into ~/.claude/skills/google-docs/SKILL.md.

What does google-docs do?

It manages Google Docs via REST API calls, letting the agent inspect document trees, create files, and execute text replacements.

Why do write operations return 403 PERMISSION_DENIED?

The default connector scope is documents.readonly. To edit or create documents, opt in to the write scope documents during setup.

Source text

SKILL.md · Apache-2.0
---
name: google-docs
description: Read and edit Google Docs via the Docs v1 REST API. Use when the user mentions a Google Doc, reading a document's text, creating a doc, inserting or replacing text, or exporting a doc's content.
when_to_use: |
  Trigger when the user wants to read a Google Doc's content, create a
  new doc, or insert / replace text in one. The connector grants
  `documents.readonly` by default; the user opts in to `documents`
  (read + write) at install — confirm before edits. Find the doc id
  from a Drive URL or a google-drive search.
connections: [google/docs]
allowed_tools: [Bash]
license: Apache-2.0
metadata:
  author: acedatacloud
  version: "1.0"
---

Drive **Google Docs** via `curl + jq`. The user's OAuth bearer token is in
`$GOOGLE_DOCS_TOKEN`; every call needs `Authorization: Bearer
$GOOGLE_DOCS_TOKEN`. Base URL: `https://docs.googleapis.com/v1/documents`. The
token carries `documents.readonly` (+ identity); writes need `documents`.

Failures are `{"error":{"code","message","status"}}` — show verbatim. `401` =
re-install. `403 PERMISSION_DENIED` on a write = read-only scope.

The doc id is the `…/document/d/<ID>/edit` segment of the URL.

```bash
D="https://docs.googleapis.com/v1/documents"; AUTH="Authorization: Bearer $GOOGLE_DOCS_TOKEN"
# Read the document. The body is a tree of structural elements; pull plain text:
curl -sS -H "$AUTH" "$D/DOC_ID" \
  | jq -r '.title, ([.body.content[]?.paragraph?.elements[]?.textRun?.content] | join(""))'
```

## Create & edit

```bash
# Create an empty doc
curl -sS -X POST -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"title":"Meeting notes 2026-06-21"}' "$D" | jq '{documentId, title}'

# Insert text at the start (index 1) via batchUpdate (confirm first)
curl -sS -X POST -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"requests":[{"insertText":{"location":{"index":1},"text":"Hello\n"}}]}' \
  "$D/DOC_ID:batchUpdate" | jq '.documentId'

# Replace all occurrences of a placeholder
curl -sS -X POST -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"requests":[{"replaceAllText":{"containsText":{"text":"{{name}}","matchCase":true},"replaceText":"Alex"}}]}' \
  "$D/DOC_ID:batchUpdate" | jq '.replies'
```

## Gotchas

- The document model is **index-based**: text edits target character indices, and
  every insert shifts later indices — for multiple inserts, apply them
  back-to-front or recompute indices between calls.
- To get clean Markdown/plain text, walk `body.content[].paragraph.elements[]
  .textRun.content` (the jq above). Tables / lists need deeper traversal.
- Creating a doc puts it in the user's Drive root; use the `google-drive` skill to
  move/share it.

© acedatacloud · Apache-2.0 · AceDataCloud/Skills

Similar skills

All skills for Writing and docs →

google-docs by other authors comes first.

google-docs sanjay3290 Creates Google Docs, locates them by title, pulls out text and edits content straight from an agent chat. Needs a Google Workspace account. CX Codex +1 564installs google-docs official OpenAI This skill creates, edits, adapts, and checks Google Docs while preserving templates, structure, and styling. Use it for documents with tabs, tables, and controlled fields. CX Codex GP ChatGPT +1 22installs google-docs membrane This skill lets an agent work with Google Docs through the Membrane CLI. Use it to create documents, read their contents, or make edits. CX Codex +1 203installs Google Docs googledocs Google Docs is an MCP server for Claude Code that searches Google Drive, reads and edits Docs, and handles comments. Connect it to assign these tasks to an agent. CX Codex +1 1,024installs FGAC.ai: Multiple Gmail Accounts, Google Sheets & Docs fgac-ai FGAC.ai: Multiple Gmail Accounts, Google Sheets & Docs is an MCP server for Claude Code that controls agent access to Google accounts. It gives the agent mail and spreadsheets, not your whole Drive. CX Codex +1 google-drive official OpenAI A skill for Codex and ChatGPT that unifies Google Drive, Docs, Sheets, and Slides work through a single interface. CX Codex GP ChatGPT +1 25installs google odyssey4me Routes all Google Workspace operations through the gog CLI. CX Codex +1 844installs recipe-create-doc-from-template official googleworkspace recipe-create-doc-from-template copies a Google Docs template, appends text content, and shares the result with collaborators via CLI. Useful for recurring briefs and reports. CX Codex +1 31,800installs Google Workspace aaronsb Google Workspace links AI agents with Google tools like Gmail, Calendar, Drive, and Sheets. Operates locally across multiple accounts right from your chat. CX Codex +1 ★ 200repo stars

From the same set67

The whole set →

Project sponsors

Companies that keep this analytics open