Format text in Google Doc
format_textApply character formatting—bold, italic, underline, strikethrough, font size, family, text or highlight color—to a Google Docs range without changing the text.
Instructions
Apply character formatting to the text in the index range [startIndex, endIndex) of a Google Doc (endIndex is exclusive): bold, italic, underline, strikethrough, fontSize (points), fontFamily (e.g. "Arial", "Roboto") and foregroundColor/backgroundColor (hex such as #1A73E8). Only the properties you pass are changed; all other formatting is kept. Pass false to remove bold, italic, underline or strikethrough. At least one property is required. Get indexes from get_document or find_text (append_text and insert_text also return the range of the new text). Does not change text or indexes.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bold | No | true = bold, false = remove bold. | |
| italic | No | true = italic, false = remove italic. | |
| endIndex | Yes | End of the range (exclusive); must be greater than startIndex. | |
| fontSize | No | Font size in points (1-400). | |
| underline | No | true = underline, false = remove underline. | |
| documentId | Yes | The Google Docs document ID (the part between /d/ and /edit in the document URL). A full Google Docs URL is also accepted. | |
| fontFamily | No | Font family name as shown in Google Docs, e.g. "Arial" or "Roboto". | |
| startIndex | Yes | Start of the range (inclusive). Get exact indexes from get_document or find_text. | |
| strikethrough | No | true = strikethrough, false = remove strikethrough. | |
| backgroundColor | No | Highlight (background) color as hex, e.g. "#FFFF00". | |
| foregroundColor | No | Text color as hex, e.g. "#1A73E8". |