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

148
Vistas
Rename spreadsheets created in AppScripts Forms

I am using a script that generates programatically some forms. I am registering the answers in a separate google spreadsheet. The problem is, whenever a new form is created, a new spreadsheet is created in my spreadsheet too. So, one spreadsheet for each form created. Is there any way to rename the new sheets created so that I'll be able to know which sheet corresponds to the created form.

Or even better, log all the responses in just one master sheet.

My appscript file is a standalone file:

I log the submitted responses with:

destination=SpreadsheetApp.openById('id');
form.setDestination(FormApp.DestinationType.SPREADSHEET, destination.getId())
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The problem is, whenever a new form is created, a new spreadsheet is created in my spreadsheet too. So, one spreadsheet for each form created.

I don't see that happening in the code provided. I can only see additional response sheets due to forms being linked in the same spreadsheet.

If what you mean is rename the created sheet on the same spreadsheet where the form is linked in your code, then see below approach.

Code:

function myFunction() {
  revisedSheetName = 'revised name';
  id = 'id'
  form = FormApp.create('test form');
  destination = SpreadsheetApp.openById(id);

  // get old set of sheets before form linking
  oldSheets = destination.getSheets().map(sheet => sheet.getSheetName());
  form.setDestination(FormApp.DestinationType.SPREADSHEET, id)
  // apply pending sheet creation
  SpreadsheetApp.flush()
  // get new set of new sheets (including new creation)
  newSheets = destination.getSheets().map(sheet => sheet.getSheetName());

  // get name of new sheet by getting the difference of new and old sets of sheets
  newSheetName = newSheets.filter(sheet => !oldSheets.includes(sheet));
  // access new sheet, then rename
  destination.getSheetByName(newSheetName).setName(revisedSheetName);
}

Sample:

sample

Output:

output

about 4 years ago · Juan Pablo Isaza Denunciar
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