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

225
Vistas
Copy Sheets with Name on tab

I have a script but I wanted to rename the sheets at the same time it's being copied. If it can also return the link ID that would be awesome too!

  function copySheets() {
  for(i=0; i<146; i++){ //change the number to however many copies you want.
  var drive=DriveApp.getFileById('SHEET ID LINK GOES HERE');
  drive.makeCopy();
  }
}

I am able to make the copies, but to rename 146 files is a lot of work. I want to run the script and inside the workbook, I have a List tab with the name of the files I want to put.

Any help is appreciated!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I understand that you want to create many copies out of a single Sheet, and you also need to return the new IDs. You can reach those goals easily by making small modifications into your script. The end result should look like this:

function copySheets() {
  var originalFile = DriveApp.getFileById(
    "{ SHEET ID }");
  var newFiles = [];

  for (i = 0; i < 146; i++) {
    newFiles.push(originalFile.makeCopy("Copy #" + i).getId());
  }

  return newFiles;
}

That script will create new copies on loop and name them in order. After the creation is done the new ID is pushed inside an array. After the loop is done the function will return that array filled with all the new IDs.

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