Style text in a doc
set_styleApply formatting like bold, color, font size, or alignment to existing text in a Google Doc without rewriting it. Target a selected snippet or the entire document to update styles directly.
Instructions
Apply styling to existing text in place (no content change), the way you select text in Docs and apply formatting. Pick ONE target: from (+ optional to) to style a selection — from the start of the unique from snippet to the end of the unique to snippet (omit to to style just from); or whole_document: true to style the entire doc/tab (e.g. one font throughout, without per-paragraph calls). Styles: bold/italic/underline/strikethrough, color (hex), fontSize (pt), fontFamily, link, paragraph alignment, and paragraph spacing (spaceBefore/spaceAfter in pt, lineSpacing %). Use get_style first to read current spacing/fonts. Prefer this over rewriting the text with edit_doc and a <span style="…">: that also works, but it makes you restate the whole run, and retyping text is how text gets silently dropped. NOTE: a direct style change, not a tracked suggestion.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | No | optional end anchor: a unique snippet; styles the whole span from the start of `from` to the end of `to` (a selection). Must appear after `from`. | |
| tab | No | Target a specific tab by tabId or title (from list_tabs). Defaults to the first tab. | |
| from | No | start anchor: a unique text snippet to style from (quote a slice from read_doc). Required unless whole_document is set. | |
| page | No | which header/footer, when a doc defines more than one (default-page, first-page, even-page). Omit to use whichever exists. | |
| style | Yes | styles to apply | |
| account | No | Google account email to use. Defaults to GDOCS_DEFAULT_ACCOUNT, or the sole account. | |
| segment | No | which content tree to target: body (default), or the page header/footer. Header/footer content is invisible to a body read — a letterhead logo lives there. | |
| documentId | Yes | Google Doc id | |
| whole_document | No | style the entire document (or tab, or the targeted header/footer) instead of a selection — e.g. to set one font throughout. Mutually exclusive with from/to. |