Google Script: How to highlight a group of words?
I'd like to write a script for google docs to automatically highlight a set of words. For one word I could use a script like this: function myFunction() { var doc = DocumentApp.openById('ID'); var textToHighlight = "TEST" var highlightStyle = {}; highlightStyle[DocumentApp.Attribute.FOREGROUND_COLOR] = '#FF0000'; var paras = doc.getParagraphs(); var textLocation = {}; var i; for (i=0; i<paras.length; ++i) { textLocation = paras[i].findText(textToHighlight); if (textLocation != null && textLocation.getStartOffset() != -1) { textLocation.getElement().setAttributes(textLocation.getStartOffset()