Google Apps Script: Read Google Document as Template

Table of contents
Reading Time: < 1 minute

DocsList services provides access to the document list

This services provides access to the document list and the files and folders in the document list. we can create files, folders, and subfolders that appear in the document list.

Here, we are going to read a Google Document as a template by Google Apps Script.

Step 1: Create a Document:

Create a document and write some text that we want to send as a template. For example:

Step 2: Create Google Script:

Now, create a Google Script and write the following code:

Step 3: Set Project Properties

To read document, first required to mentioned the project name and document id in the project properties.

Go File -> Project Properties -> Project Properties Tab

Click on Add row. Give project name as ‘EmailTemplateDocId’ and its doc id in value field. Doc id is the document id. It displays in document url as  ‘…/document/d/<doc_Id>/edit.