I would like to integrate a document merge into a workflow which I created in Google App Maker. Whenever an input is submitted in a form, the answers should be merged into a Google Docs template, if the template contains a placeholder that matches the name of the field. For example, if the field name is last_name, the placeholder would be {{last_name}}.
The document merge should go through each field of every item, so that I don't have to program the field names into the script. In a Google Spreadsheet this would be resolved by using a loop like
function documentMerge() {
var ss = SpreadsheetApp.getActiveSpreadsheet.getActiveSheet;
var lastClmn = ss.getDataRange.getLastColumn();
var lastRow = ss.getDataRange.getLastRow();
for (var i=0, lastClmn, i++) {
for (var j=1, lastRow, j++) {
// if '{{' + (ss.getRange(0, i).getValue()) + '}}' is found in document
// ... replace placeholder in document with contents from column i, row j ...
}
Is there something similar possible in Google App Maker?