I have a table that has three columns of employee info. The first column has the employe names. I want to write a google apps script that will duplicate a pre-formatted template sheet and re-name it with the employee name. At the end of the script each employee will have their own sheet named after them.
Here is the code I have so far, I am using some functions from the Google scripts tutorial, but I am at a loss on how to proceed further. EDITED, I have gotten a little further, this code worked once but now is getting hung on setName:
//Create new sheets for each employee in the list
function createEmployeeSheets() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
// Get the range of cells that store employee data.
var employeeDataRange = ss.getRangeByName("EmployeeRef");
// For every row of employee data, generate an employee object.
var employeeObjects = getRowsData(sheet, employeeDataRange);
for (i=0; i < employeeObjects.length; i++) {
var EmployeeName = employeeObjects[i].name;
ss.setActiveSheet(ss.getSheetByName("Template"));
SpreadsheetApp.getActiveSpreadsheet().duplicateActiveSheet();
var first = ss.getSheetByName("Copy of Template 1");
first.setName(EmployeeName);
}
}