Learn how to find and replace text with a link in Google Docs with Google Apps Script Document App with 3 different scenarios.
So you are a citizen Google Apps Script developer and you’ve decided to make yourself a mail-merge-type project where you want to create new documents from a template. … Now you want to take it to the next level and replace the text with a hyperlink containing the text and the URL. You might be scratching your head wondering where the
replaceTextWithLink()method is or why you can’t simply chain the
setLinkUrl()method without making a hyperlink out of the entire body of the document.
Another one of Scott Donald’s very thorough tutorials, this one exploring link creation in Google Docs.
Source: How to find and replace text in a Google Doc with a link or a list of links with Google Apps Script – Yagisanatode
Member of Google Developers Experts Program for Google Workspace (Google Apps Script) and interested in supporting Google Workspace Devs.