I am attempting to build a user interface for a spreadsheet (whether through a menu add on or sidebar) that asks a user to select from a dynamic list of 'templates'. I want each item in the list of templates to run the below function with var templateName being the users selection in the list.
I have attempted a dynamic menu but this is not working for me
Google Apps Script: Dynamically creating spreadsheet menu items
Is this possible in apps script?
function getTemplate(templateName){
//Retrieves the template file and opens it to retrieve templates
var getTemplateFile = DriveApp.getFilesByName('Evaluation Templates')
while (getTemplateFile.hasNext())
var openTemplates = getTemplateFile.next()
var templateId = openTemplates.getId()
var openSpreadsheet = SpreadsheetApp.openById(templateId)
//Retrieves the template sheet tab by the name selected in the menu
var getTemplateSheet = openSpreadsheet.getSheetByName(templateName)