Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

413
Vistas
Is it possible to merge multiple google docs into one using Apps Script?

I wanted to the question as formulated in the title, let me elaborate further. I selected the response destination from Forms into a new spreadsheet. Using Google Script I created an add-on (named AutoFill Docs) for this spreadsheet and it "fills out" the Docs template I made and saves itself as a new, separate Docs file in a designated folder.

function onOpen() {
  const ui = SpreadsheetApp.getUi();
  const menu = ui.createMenu('AutoFill Docs');
  menu.addItem('Create New Docs', 'createNewGoogleDocs')
  menu.addToUi();

}

function createNewGoogleDocs() {

  const Responses = DriveApp.getFileById('XXXXX');

 
  const destinationFolder = DriveApp.getFolderById('XXX')

  const sheet = SpreadsheetApp
    .getActiveSpreadsheet()
    .getSheetByName('Data')
  
  const rows = sheet.getDataRange().getValues();
  
 
  rows.forEach(function(row, index){
    //skipping header
    if (index === 0) return;
    //Using the row data in a template literal, making a copy of template document in destinationFolder
    const copy = Responses.makeCopy(`${row[1]}, ${row[0]} XXXX (XXXX)` , destinationFolder)
  
    const doc = DocumentApp.openById(copy.getId())
   
    const body = doc.getBody();
  
    //replacing my replacement tokens with values from the spreadsheet row
    body.replaceText('{{Timestamp}}', row[0]);
    body.replaceText('{{Whats your name?}}', row[1]);
   
//end so on
  

    doc.saveAndClose();
  
    const url = doc.getUrl();

    //making documents links 
    sheet.getRange(index + 1, 16).setValue(url)
    
  })
  
}

My issue is, that I want all those filled-out templates for every response to save in one docs file (e.g. one response=one new extra page), rather than a new doc file. Of course, I can include links to those docs in the final one or copy and paste, but I prefer it to be automatic.

So here are my concerns: Is it even possible? If yes, how should I modify my existing code to do that or what should I look for?

P.S. I know the "createNewGoogleDocs" is basically the opposite of what I want, but this is the only function I managed to find, but it is just a partial solution to my case. I am a complete newbie, so any guidance/suggestions are very much appreciated, I'm completely stuck.

about 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda