Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

221
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!