After conducting some research on how to execute a row call using Google Apps Script, I have encountered a slight challenge and would greatly appreciate any assistance with this matter.
This script examines the values in the first column and uses them to rename new tabs.
function newSheet() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var templateSheet = ss.getActiveSheet();
var sheet1 = ss.getSheetByName("main");
var getNames = sheet1.getRange("A2:A").getValues().filter(String).toString().split(",");
for (var i = 0; i < getNames.length; i++) {
var copy = ss.getSheetByName(getNames[i]);
if (copy) {
Logger.log("Sheet already exists");
} else {
templateSheet.copyTo(ss).setName(getNames[i]);
ss.setActiveSheet(ss.getSheetByName(getNames[i]));
ss.moveActiveSheet(ss.getNumSheets());
}
}
}
The image of the sheet can be found here:
https://i.sstatic.net/5CNCb.png
My current challenge lies in copying only the rows with specific data to the newly created tabs/sheets. For example, when creating a tab named Levi, I want only the row containing Levi's data to be copied to that sheet.
Currently, my code duplicates the entire source sheet onto the new tabs/sheets. Any help with refining this functionality will be highly appreciated.