edit_docsrequired
ARRAY<OBJECT>(Required) A list of requests to execute on the document. Each request must be a dict containing exactly ONE of the valid request types listed below.
Common request types:
replaceAllText, insertText, updateTextStyle, createParagraphBullets, deleteParagraphBullets, createNamedRange, deleteNamedRange, updateParagraphStyle, deleteContentRange, insertInlineImage, insertTable, insertTableRow, insertTableColumn, deleteTableRow, deleteTableColumn, insertPageBreak, deletePositionedObject, updateTableColumnProperties, updateTableCellStyle, updateTableRowStyle, replaceImage, updateDocumentStyle, mergeTableCells, unmergeTableCells, createHeader, createFooter, createFootnote, replaceNamedRangeContent, updateSectionStyle, insertSectionBreak, deleteHeader, deleteFooter, pinTableHeaderRows, addDocumentTab, deleteTab, updateDocumentTabProperties, insertPerson.
Do NOT use request types from other Google APIs (Slides, Sheets, etc.).
For full request schemas, see https://developers.google.com/docs/api/reference/rest/v1/documents/batchUpdate.
SEGMENT IDs: Use empty string "" for document body, or a header/footer/footnote ID from the document. Internal 'kix.' IDs are NOT valid segment IDs and will cause "Segment with ID ... was not found" errors. Call GOOGLEDOCS_GET_DOCUMENT_BY_ID to get valid IDs.
TAB IDs: When omitted, operations target the first tab. Invalid tab IDs cause errors. Get valid tab IDs from GOOGLEDOCS_GET_DOCUMENT_BY_ID at tabs[].tabProperties.tabId.
BATCH INSERT OPERATIONS: Operations execute sequentially. Each insertText shifts subsequent indices. For multiple inserts at specific positions, process in REVERSE index order (highest first). For appending, use endOfSegmentLocation for each insert. Auto-correction: insertText without location/endOfSegmentLocation automatically appends to document body.
INDEX BOUNDARIES: location.index must be LESS than the segment end index (valid: 1 to N-1). To insert at the end, use endOfSegmentLocation instead.
PARAGRAPH BOUNDARIES: Text can only be inserted inside existing paragraphs, not at structural boundaries (e.g., a table's start index). For table cells, add +1 or +2 to the cell's startIndex.
deleteContentRange: The range CANNOT include the trailing newline at segment end. If segment ends at N, use endIndex: N-1.
deleteTableRow: Requires tableCellLocation object (NOT top-level rowIndex/tableStartLocation). Structure: { tableCellLocation: { tableStartLocation: { index: N }, rowIndex: R, columnIndex: C } }.
updateTableCellStyle: Use EITHER tableStartLocation (all cells) OR tableRange (specific cells), not both.
Style updates (updateParagraphStyle, updateTextStyle, updateTableCellStyle, updateDocumentStyle): The 'fields' parameter is auto-populated from style keys if omitted.
Document title CANNOT be updated via batchUpdate - use Google Drive API instead.
updateDocumentStyle valid fields: background, marginTop, marginBottom, marginLeft, marginRight, marginHeader, marginFooter, pageSize, pageNumberStart, useEvenPageHeaderFooter, useFirstPageHeaderFooter, flipPageOrientation (NOT "title").