Google Apps Script: Get Google Doc Text Based on Reference Characters

Google Apps Script: Google Docs, Document App. Javascript: Spread syntax, Set, IndexOf, Substring

So here is the scenario, imagine you have a big Google Doc. You want to get a list of information from the document that you have noticed are between two sets of characters. Maybe something like this:

  1. You want to grab all the quoted text in a story and you know that the quoted test is between two sets of quotation marks: “ ”.
  2. You want to grab citations or asides inside different braces, for example, [],{} or ().
  3. You are making a mail merger and you want to grab a specific list of words that the user put in that is to be substituted based on special character identifiers, for example, {{name}}, {{phone}}.
  4. You want to grab all the websites in a Google doc and you know they start will start with https:// and with .gov .

This tutorial provides a simple how-to do this.  Perhaps the code is exactly what you need for your project. We’ve set it up in a way that is easy to implement in your own project.

Continue reading “Google Apps Script: Get Google Doc Text Based on Reference Characters”