* Main run file sets up variables for insertion into the mailMerge()Ĭonst TEMPLATE_ID = '1_wC7i8N-MOmiSsUpAMC1HiWB-yxpD7GwcWw_iPu-noY' //Add your Google Doc template IDĬonst SS_ID = '17_g4italen3qrT9MitLqQPuyZdg4zazxS88L6uv37BU' // Add your Google Sheet IDĬonst SHEET_NAME = "Merge" // Add your Google Sheet Tab nameĬonst MAPPED = mappedDocToSheet // Go to Map.gs to updateĬonst FILE_NAME = // Header IDs from your Sheet. * Create multiple versions of a document based on Google Sheet Data
Note: As always, take what you need and don’t worry about the rest.
DATA MERGE GOOGLE DOCS HOW TO
Then, we will set up a template for our Google Doc and generate our Google Sheet data ( don’t worry, I’ll share the document so you can follow along).įinally, we will jump into the breakdown of the code for those legends who are learning how to create their own Google Apps Script. If you want to quickly jump into your own project with our script, I’ll provide you with a quick-use guide. In this tutorial, we will create a document merger that will create new Google Documents based on a dataset from a Google Sheet using Google Apps Script. These days, we don’t often use the snail mail approach, but it is a regular occurrence for us to need to produce multiple versions of reports based on a data set usually from a spreadsheet. Traditionally, mail merge is used to create multiple versions of a document and snail-mail them to someone. If you have ever worked in LibreOffice or Microsoft Excel you will probably be familiar with the mail merge.
Google Apps Script: SpreasheetApp, DocumentApp, DriveApp Google Sheets, Google Docs