When working with Google Scripting, there's a Browser.msgBox();
(Link) and ui.alert();
(Link). What is the difference between the two? They appear to do the exact same thing.
There are more methods within, such as Browser.inputBox();
and ui.prompt();
which again, appear to be identical.
To display a pop up alert message, you need to write some code using Google Apps Script. Don't worry, it is very simple and straightforward to do that. If you've never worked with Apps Script before, I've written an article that explains how to create and run your first apps script.
Apps Script allows you to connect Google Forms with Google Sheets through Forms and Spreadsheet services. This feature can automatically create a Google Form based on data in a spreadsheet. Apps Script also enables you to use triggers, such as onFormSubmit to perform a specific action after a user responds to the form.
To run the script in debug mode, at the top of the editor click Debug. Before the script runs the line with the breakpoint it pauses and displays a table of debug information. You can use this table to inspect data like the values of parameters and the information stored in objects.
The Browser Class is only available to a Spreadsheet. The Ui Class can be more widely used. Unfortunately, the documentation for Class Ui only shows an example of the getUi()
method with the SpreadsheetApp Class. But getUi()
is available to DocumentApp.
And to:
FormApp.getUi()
If you try to call Browser.msgBox()
from the wrong context, you'll get an error:
Cannot call Browser.msgBox() from this context; have you tried Logger.log() instead?
Browser.msgBox()
is easier to use in a Spreadsheet script. You don't need to first use var ui = SpreadsheetApp.getUi();
To compare:
Browser.msgBox('prompt here');
SpreadsheetApp.getUi().prompt('prompt here');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With