Loading...
Loading...
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.
npx skill4agent add acedatacloud/skills google-docscurl + jq$GOOGLE_DOCS_TOKENAuthorization: Bearer $GOOGLE_DOCS_TOKENhttps://docs.googleapis.com/v1/documentsdocuments.readonlydocuments{"error":{"code","message","status"}}401403 PERMISSION_DENIED…/document/d/<ID>/editD="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 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'body.content[].paragraph.elements[] .textRun.contentgoogle-drive