Google Docs Batch Update icon

Google Docs Batch Update

Build and send Google Docs batch update requests

Create Document Request → Update Paragraph Style

AI-generated

Summary

Update Paragraph Style

Inputs

  • startIndex (required) — The zero-based index, in UTF-16 code units. The index is relative to the beginning of the segment specified by segmentId
  • endIndex (required) — The zero-based index, in UTF-16 code units. The index is relative to the beginning of the segment specified by segmentId
  • additionalLocationFields — Additional fields for the end of segment location
  • style — Paragraph style configuration (e.g., alignment, named style, borders, spacing, etc.)
  • fields — List of style fields to update; each can reference specific style subfields

Output shape

object with a 'replies' array containing the results of applying the paragraph style updates

Success returns a response containing a 'replies' field; failures return an error object. The shape may vary per batch but always includes the applied updates.

Examples

Example 1: Update a paragraph's alignment and named style in a newly created doc

startIndex: 0, endIndex: 10, style: {alignment: 'CENTER', namedStyleType: 'HEADING_1'}, fields: ['alignment','namedStyleType']

Example 2: Apply a border and spacing to a specific segment

startIndex: 5, endIndex: 15, additionalLocationFields: {segmentId: '123', tabId: '456'}, style: {borderBottom: {values: {color: '#FF0000', width: 2}}, lineSpacing: 120}, fields: ['borderBottom','lineSpacing']

Links

Discussion