Reputation: 16102
Here is the documentation I'm trying to follow.
// Display a dialog box with a title, message, input field, and "Yes" and "No" buttons. The
// user can also close the dialog by clicking the close button in its title bar.
var ui = SpreadsheetApp.getUi();
var response = ui.prompt('Getting to know you', 'May I know your name?', ui.ButtonSet.YES_NO);
// Process the user's response.
if (response.getSelectedButton() == ui.Button.YES) {
Logger.log('The user\'s name is %s.', response.getResponseText());
} else if (response.getSelectedButton() == ui.Button.NO) {
Logger.log('The user didn\'t want to provide a name.');
} else {
Logger.log('The user clicked the close button in the dialog\'s title bar.');
}
I expect the UI to display a dialog box with a title, message, input field, and "Yes" and "No" buttons. The user can also close the dialog by clicking the close button in its title bar.
But instead, nothing happens.
But as I mentioned, nothing actually happened.
How do I trigger the UI instance to initiate? What am I doing wrong?
Upvotes: 0
Views: 337
Reputation: 64032
Run this function:
function runIt() {
var ui = SpreadsheetApp.getUi();
var response = ui.prompt('Getting to know you', 'May I know your name?', ui.ButtonSet.YES_NO);
if (response.getSelectedButton() == ui.Button.YES) {
Logger.log('The user\'s name is %s.', response.getResponseText());
} else if (response.getSelectedButton() == ui.Button.NO) {
Logger.log('The user didn\'t want to provide a name.');
} else {
Logger.log('The user clicked the close button in the dialog\'s title bar.');
}
}
After getting the function to run go look at the spreadsheet.
Upvotes: 1