Skip to content

Instantly share code, notes, and snippets.

@cromwellryan cromwellryan/code.gs
Created Jul 27, 2018

Embed
What would you like to do?
//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
You can’t perform that action at this time.