Batch Update Doc
batch_update_docApplies multiple document edits, such as text insertion, formatting, tables, and page breaks, in one atomic batch update to keep changes consistent.
Instructions
Executes multiple low-level document operations in a single atomic batch update.
For normal header/footer text, prefer update_doc_headers_footers. Only use create_header_footer here for advanced section-break layouts.
RECOMMENDED WORKFLOW FOR BUILDING DOCUMENTS:
To avoid index calculation errors, build documents in phases:
PHASE 1 - INSERT ALL CONTENT (use end_of_segment=true, no index math): Append text, section breaks, and page breaks sequentially. Each operation appends to the end of the body. No index needed. Example batch: [ {"type": "insert_text", "end_of_segment": true, "text": "Report Title\n"}, {"type": "insert_text", "end_of_segment": true, "text": "\nExecutive Summary\n"}, {"type": "insert_text", "end_of_segment": true, "text": "Revenue grew 15%.\n"}, {"type": "insert_section_break", "end_of_segment": true, "section_type": "NEXT_PAGE"}, {"type": "insert_text", "end_of_segment": true, "text": "Detailed Analysis\n"} ]
PHASE 2 - CREATE HEADERS/FOOTERS (if needed): For normal header/footer text, use update_doc_headers_footers (it auto-creates if missing and writes the content for you). Only include create_header_footer operations in a batch when you are intentionally managing advanced section-break-specific layouts.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"user_google_email": "<user_google_email>",
"document_id": "<document_id>",
"operations": "<operations>"
},
"name": "batch_update_doc"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| operations | Yes | List of operation dicts. Each operation MUST have a 'type' field. All operations accept an optional 'tab_id' to target a specific tab. | |
| document_id | Yes | ID of the document to update | |
| user_google_email | Yes | User's Google email address |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |