Skip to content

Instantly share code, notes, and snippets.

@cromwellryan
Created July 27, 2018 17:22
Show Gist options
  • Select an option

  • Save cromwellryan/7db57b19176fe8ba40c2b39c2b922d8b to your computer and use it in GitHub Desktop.

Select an option

Save cromwellryan/7db57b19176fe8ba40c2b39c2b922d8b to your computer and use it in GitHub Desktop.
//This script will allow you to make a whole lot of
//copies of a document in your Google Drive.
//If the original is in a folder, then the copies will be made
//in the same folder
//be careful of what you change. Each semicolon is very important.
function copyDocs() {
var activeDocument = DocumentApp.getActiveDocument();
var fileId = activeDocument.getId();
var file = DriveApp.getFileById(fileId);
var people = [
'Name 1',
'Name 2' //keep going
];
var originalName = file.getName();
people.forEach( function (personName) {
file.makeCopy(originalName + ' ' + personName);
});
}
//When you have changed the nubmer of copies and the document ID in the script,
//you will click on the save icon and then go to the Run menu and choose copyDocs.
//Authorize the script and copies will be made to your drive.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment