Skip to content

Instantly share code, notes, and snippets.

@osantana
Created March 14, 2022 16:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save osantana/f729d0565a133cdfe49db5cd7ac5c43c to your computer and use it in GitHub Desktop.
Save osantana/f729d0565a133cdfe49db5cd7ac5c43c to your computer and use it in GitHub Desktop.
Google Docs Highlight Words
function highlightWords() {
wordList = ["obséquio", "amplexos", "mormente", "vós"];
content = DocumentApp.getActiveDocument().getBody();
wordList.forEach((word) => {
let range = content.findText("(?i)" + word);
let element = range.getElement();
element.asText().setBackgroundColor("#ff0000");
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment