A
A
Alexander2020-11-04 09:58:50
Google Apps Script
Alexander, 2020-11-04 09:58:50

google apps script. Alert, Prompt why are no messages displayed?

Hello! Help a newbie.
In the Google spreadsheet from "Tools" - "Script Editor" created sample scripts:

function showPrompt1() {
var ui = SpreadsheetApp.getUi();
var response = ui.prompt('May I know your name?', ui.ButtonSet.YES_NO);
}

function showAlert() {
var ui = SpreadsheetApp.getUi(); // get ui for alert
ui.alert('Hello!, Hello');
}

When launched in run mode, they hang, and when launched and in "debug" mode, I get the message "Could not connect to server".

The below script works, when the table is opened, a message is issued.

function onOpen() {
var ui = SpreadsheetApp.getUi(); // get ui for alert
ui.
}

Tell me, please, what is the reason and how to fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2020-11-14
@Aleksvrn

Thank you for your attention. Everything turned out to be just as expected. Before that I worked in VBA. There, running the macro in debugging, I immediately saw the dialog boxes without going to the table. That's what GAS expected. However, as it turned out, in order to see the Alert and prompt windows in GAS, you need to switch to the table, it is better to run the script from the table. So everything works.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question