I have a script on Google Sheets that works fine from a menu. The script is designed that when I select a certain cell, then run the script using the menu choice I created, it uses an HTML template to create a form, and the results of that form create content for that cell. I would like to simplify the process and use the 'onSelectionChange' trigger to see if they selected that cell. When I use that trigger to call the script, on the last line of this section:
const template = HtmlService.createTemplateFromFile('selDialog');
template.optionsData = getPlayers();
const html = template.evaluate();
SpreadsheetApp.getUi().showModalDialog(html, 'Select Players');
I find the error in the Stackdriver logs Exception: You do not have permission to call Ui.showModalDialog. Required permissions: https://www.googleapis.com/auth/script.container.ui
I have searched the error, but I am still unsure how to resolve it. Should I use a different method of displaying the HTML form that I use to collect the data? I have seen the suggestion that perhaps showModalDialog is depreciated. I just find it odd that it works perfectly if I call the script from a custom menu in Sheets rather than using 'onSelectionChange'