I have an Google sheet with some apps script code in it and I am trying to make it interactive by displaying a prompt and getting some user input. I have added a simple function to test that this works:
function displayPrompt() {
var ui = SpreadsheetApp.getUi();
var result = ui.prompt("Please enter a name for your report:");
Logger.log(result.getResponseText());
};
When I run it, I get the error: "Exception: Cannot call SpreadsheetApp.getUi() from this context."
What am I doing wrong please?
Thanks Annette