OAuth
📄 Google Docs
Read, create and update Docs as Markdown.
What you can do
- Pull a Doc as Markdown for an LLM to summarize
- Create new Docs from Markdown content
- Replace a Doc's content with Markdown, keeping its ID, link and sharing
- List recent Docs in your Drive
- Make precise edits with raw Docs API requests (
structure,tabs,batch)
Setup
agentio gdocs profile add
gdocs asks for full Google Drive access, so update can rewrite documents agentio did not create. A profile signed in with an earlier version must sign in again: agentio profile reauth gdocs <profile>.
Editing from Markdown
agentio gdocs get 1A2bCdEf... --output doc.md
# edit doc.md
agentio gdocs update 1A2bCdEf... --file doc.md
update replaces the whole document. It refuses, unless you add --force, when that would lose something Markdown cannot carry: extra tabs, pending suggestions, or open comments. To change one part without touching the rest, read the indices with structure and send requests with batch.
Markdown fidelity
Google converts the Markdown in both directions: agentio does not. What comes through:
- Headings, bold, italic, strikethrough, inline code, links
- Bullet, numbered and check lists, nested lists
- Tables, code blocks, blockquotes, horizontal rules, footnotes
- Images, fetched from their URL when the document is created
What is lost or changed:
- Comments and suggestions.
getexports a pending suggestion as plain text, with both the inserted and the deleted words, so accept or reject suggestions before a round trip. - Headers, footers, smart chips, drawings, exact fonts and colours
- Tabs:
getexports every tab one after the other, each under its title as a heading;updaterewrites the document as a single tab. - Consecutive blockquotes merge into one, and nested checklist items become plain text.
- An escaped pipe in a table cell (
a \| b) comes back unescaped, which drops the rest of the cell on the nextupdate. getreturns images as embedded base64 data, which makes the Markdown large.
Command reference
-
agentio gdocs get <doc-id-or-url>Export a document
--profile <name>--format <format>--output <file> -
agentio gdocs createCreate a new document from Markdown
--profile <name>--title <title>--content <text>--folder <folder-id> -
agentio gdocs update <doc-id-or-url>Replace the whole document with Markdown (same document ID and link)
--profile <name>--content <text>--file <path>--title <title>--force -
agentio gdocs listList recent documents
--profile <name>--limit <n>--query <query> -
agentio gdocs structure <doc-id-or-url>Dump the full Docs API document representation as JSON
--profile <name>--tab <tab-id>--all-tabs -
agentio gdocs tabs <doc-id-or-url>List the tabs of a document (ID, title, nesting)
--profile <name> -
agentio gdocs batch <doc-id-or-url>Execute raw documents.batchUpdate requests (escape hatch)
--profile <name>--requests-json <json>--file <path>
Related changelog entries
- feat guard `gdocs update` and request full Drive access 6a55808
- feat replace a document's content from Markdown 5749e72
- feat add tab support to structure and a new tabs command (#26) c846166
- feat return full replies JSON from batch + add structure command 3b8783a
- feat add batchUpdate command for raw Docs API requests bf6b4cf
- feat add LLM-friendly examples to all gdocs commands 366b098
- feat add Google Docs service with markdown import/export c059073