Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

228
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda