Style a text range
style_textChange the style of any text range in a Google Doc: bold, italic, underline, color, font, links, superscript/subscript, using start and end indexes. Only the specified formatting is updated.
Instructions
Applies character formatting to [start_index, end_index): bold, italic, underline, strikethrough, small_caps, font_size (points), font_family (e.g. "Roboto"), foreground_color/background_color (6-digit hex), link_url (empty string removes an existing link) and baseline_offset (superscript/subscript/none). Only the provided fields change (the fields mask is computed); at least one is required. Explicit false turns a toggle off. Get indexes from read_document_text. Styling does not shift indexes, so several style calls can safely reuse the same coordinates.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bold | No | Bold on/off. | |
| italic | No | Italic on/off. | |
| tab_id | No | Tab to target (from list_tabs). Omit for the first/only tab. | |
| link_url | No | Turn the range into a link to this URL; empty string removes an existing link. | |
| end_index | Yes | End of the range to style (exclusive). | |
| font_size | No | Font size in points. | |
| underline | No | Underline on/off. | |
| segment_id | No | Header/footer/footnote segment id (from get_document). Omit for the document body. | |
| small_caps | No | Small caps on/off. | |
| document_id | Yes | The document id — the long id from the document URL (docs.google.com/document/d/<documentId>/edit) or from create_document output. | |
| font_family | No | Font family name, e.g. "Roboto". | |
| start_index | Yes | Start of the range to style (inclusive). | |
| strikethrough | No | Strikethrough on/off. | |
| baseline_offset | No | Vertical offset of the text. | |
| background_color | No | Text highlight color, e.g. "#ffff00". | |
| foreground_color | No | Text color, e.g. "#1a73e8". |