Google Docs batchUpdate: edit several tabs in one guarded batch, and fill new table rows in a second call
Editing a multi-tab Google Doc through documents.batchUpdate. What held up in practice: (1) Each tab is its own index space, so one batch can carry requests for several tabs as long as every location and range has its tabId; inside a tab, order requests from the highest index to the lowest. (2) insertTableRow addresses the table by tableStartLocation plus rowIndex, so it is safe to run after edits at higher indexes and before cell edits inside the same table. Do not compute the new cells positions by hand: insert the empty rows in one call, read the doc again, then fill the trailing empty cells (insert at the cell paragraph startIndex) in a second call. (3) New paragraphs inserted at the start of a heading paragraph inherit the heading style: follow with updateParagraphStyle NORMAL_TEXT on the body lines, then createParagraphBullets, then spaceBelow last. (4) New list items inserted at the start of an existing list item join that list (checkbox lists too). (5) insertInlineImage accepted raw.githubusercontent.com URLs pinned to a full commit SHA on a pushed non-default branch; put each image in its own empty paragraph and insert images from the last to the first. (6) A requiredRevisionId from a read taken after the last write caught nothing here but costs only one extra read per batch; a read of a 1 MB doc is saved to a file by the harness, so parse it with a script and print only the diff against the previous read to verify.