Overview
The Docs service provides access to Google Docs v1 API for reading document content and making structured edits via batch updates. API:docs (v1)
Common Use Cases
- Read document content
- Append text to documents
- Apply rich formatting
- Insert images and tables
- Replace text
Helper Commands
+write
Append plain text to the end of a document:
- Automatically appends to document body
- For rich formatting, use the raw
batchUpdateAPI
Command Examples
Create a Document
Empty document
Example Response
Example Response
Read a Document
Example Response (snippet)
Example Response (snippet)
Insert Text
Insert at beginning
Append to end
Format Text
Bold text
Change font and size
Replace Text
Find and replace
Insert Image
From URL
Insert Table
Delete Content
Delete range
Apply Paragraph Style
Heading 1
Create Bullet List
Insert Page Break
Batch Updates
Multiple operations can be combined in a single request. Operations are applied in order:Insert and format text
Document Structure
Docs are structured as a flat list of content elements with indices:- Index
1is the start of document body - Each character, newline, and embedded object occupies one index
- To append to end, find the last index from a
getrequest
Resources
documents- Document operations (create, get, batchUpdate)
gws docs documents --help to see all available methods.
Related Commands
Drive
Manage document files
Sheets
Work with spreadsheets