Basically, I have a list of 200 people's names in the range 'Names'!A1:A200
. I have another tab named Template. I need a script to duplicate Template 200 times and rename each of the tabs to the name of each of the people in the range 'Names'!A1:A200
. Is this possible?
1 Answer
function onOpen() {
SpreadsheetApp.getUi().createMenu('My Menu')
.addItem('Create New Tabs', 'createTabs')
.addToUi()}
function createTabs() {
var ss = SpreadsheetApp.getActive()
ss.getSheetByName('Names').getRange('A:A').getValues().filter(String)
.forEach(function (sn) {
if (!ss.getSheetByName(sn[0])) {
ss.insertSheet(sn[0], ss.getSheets().length);}})}
This script will create a new custom menu/submenu with the option to create new tabs/sheets. The usage is: create a new sheet and rename it to Names and then populate column A with desired names
Ema
Emily
etc.
and then go to My Menu and select Create New Tabs
and for template copy/duplication you may want to check: