Google Apps Script: Consolidating Multiple Form Responses into a Single Document

Current Setup

I have a Google Form that feeds data into a spreadsheet. When someone submits the form, my Apps Script automatically creates a new Google Doc for each submission. This works fine but creates too many separate documents.

What I Want to Achieve

Instead of generating individual docs for every form response, I want to append all submissions from the same person into one master document. This way each team member would have just one doc containing all their entries instead of dozens scattered around.

My Current Code

function processFormData(event) {
  var clientName = event.values[1];
  var submissionDate = event.values[2];
  var status = event.values[3];
  var category = event.values[4];
  var userComments = event.values[5];
  var feedback = event.values[6];
  var additionalInfo = event.values[7];
  var staffMember = event.values[8];
  var managerName = event.values[9];
  
  var sourceTemplate = DriveApp.getFileById("template-id-here");
  var destinationFolder = DriveApp.getFolderById("folder-id-here");
  var newCopy = sourceTemplate.makeCopy(clientName, destinationFolder);
  var document = DocumentApp.openById(newCopy.getId());
  var documentBody = document.getBody();
  
  documentBody.replaceText("{{Client Name}}", clientName);
  documentBody.replaceText("{{Submission Date}}", submissionDate);
  documentBody.replaceText("{{Status}}", status);
  documentBody.replaceText("{{Category}}", category);
  documentBody.replaceText("{{User Comments}}", userComments);
  documentBody.replaceText("{{Feedback}}", feedback);
  documentBody.replaceText("{{Additional Info}}", additionalInfo);
  documentBody.replaceText("{{Staff Member}}", staffMember);
  documentBody.replaceText("{{Manager Name}}", managerName);
  
  document.saveAndClose();
}

My Question

How can I modify this to append new form submissions to an existing document instead of creating new ones? I’m thinking about copying the content from the newly created doc into a master doc and then deleting the temporary one. Is this approach feasible with Apps Script?

yeah, totally doable. first check if there’s already a doc for that person using DriveApp.getFilesByName() - search by client name. if it exists, open it. if not, create a new one. then just append your new content to the existing doc body instead of swapping out placeholders.

I did something similar for our quarterly reports. Skip the name checking and ID storage - just use folders. Give each client their own folder with a standard doc name like ‘ClientName_MasterReport.docx’. In your processFormData function, search the destination folder first using folder.getFilesByName(clientName + ‘_MasterReport’). Found it? Open the doc and use appendTable() or appendParagraph() to add the new data. No file? Create a new master doc from your template. Format your new content as a clean block that appends easily - I throw in horizontal line separators between submissions so they’re easy to spot in the master doc.

I dealt with this recently. The trick is using consistent naming for your master documents and storing document IDs directly in your spreadsheet - add a column that tracks which document belongs to each client. Don’t search by name, it’s unreliable. Use DocumentApp.openById() to grab the existing document. For adding content, build your template as a formatted string, then use appendParagraph() or insertParagraph() to add it to the existing doc. Way more reliable than copying and deleting temp documents, and your formatting stays consistent across multiple submissions.