Insert hyperlink in Google Doc
insert_linkTurns existing text in a Google Doc's index range into a hyperlink to an HTTP, HTTPS, or mailto URL, replacing any existing link. Use get_document or find_text to get indexes.
Instructions
Turn the existing text in the index range [startIndex, endIndex) of a Google Doc into a hyperlink to url (http, https and mailto links only). The text itself is not changed and any link already on it is replaced. To link new text, first add it with insert_text or append_text (both return the new text’s range), then link that range. Get indexes from get_document or find_text. Does not change indexes.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | Link target, e.g. "https://example.com" or "mailto:someone@example.com". | |
| endIndex | Yes | End of the range (exclusive); must be greater than startIndex. | |
| 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. | |
| startIndex | Yes | Start of the range (inclusive). Get exact indexes from get_document or find_text. |