I am working with Google Apps Script.
I have a master spreadsheet, of which I want to: make a number of copies, rename the copies, save them to a specified folder, and finally add a different editor to each of the copies
The list of names and editors comes from a table that contains in one column the name of the spreadsheet, and in the other the email addresses of the desired editors.
I have so far managed to write the following code:
function testCreaSpreadsheet() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
var names = sheet.getRange("A2:A11").getValues();
var emails = sheet.getRange("B2:B11").getValues();
var ssToCopy = DriveApp.getFileById("XXXXX");
var folder = DriveApp.getFolderById("YYYYY");
for (var i in names){
var fileCopiato = ssToCopy.makeCopy("Foglio Offerte - " + names[i],folder)
}
}
This accomplishes the first three goals that I wanted to obtain, but I am struggling to find a way to add the editors directly from the data that I have in the table. Is this possible at all and, if so, what would be the best way to do it?