google-sheetsgoogle-apps-scriptweb-applications

SpreadsheetApp.getUi().showModalDialog has changed since 26072024


I have been using this code with GAS in Sheets to display two dialogs successfully for a long time:

function demo() {
   SpreadsheetApp.getUi().showModalDialog(HtmlService.createHtmlOutput('<b>Patience!</b>'), 'Processing! Please wait');

//do some stuff

   SpreadsheetApp.getUi().showModalDialog(HtmlService.createHtmlOutput('<script>google.script.host.close();</script>'), 'Ready. Please continue');  
}

Since yesterday (26.07.2024) this code does not work (i.e. the first dialog does not close) as before which is described very well in this thread.

Hence, does anybody know if this is a permanent change or if it is a temporary glitch?

Is there any documentation anywhere describing this new behaviour?

My GAS skills are very basic and I do not understand how the solution/work around in the thread above can be applied to me since I am only using Google Sheets.

Back in the day I used to use this approach, but it sucked of course:

SpreadsheetApp.getActive().toast("Processing...", "Please WAIT!", 60); 

Since my productive application stopped running - i.e. the end users do not know how to cope - because of this change/bug I am a bit desperate and looking for a quick fix to solve this.

Additional information added 30072024: the script is executed through an onEdit-trigger. By using a barcode scanner which acts as HID (keyboard etc.) the end-user 'edits' the sheet and the script is triggered.

Just as a point of explanation why this functioanlity (as it worked up until 26072024) is so valuable: whilst a modal dialog box is open the sheet itself is 'greyed out' and the sheet cannot be edited from the screen where the modal box is open.

Thus, while the script is executing the modal dialog box is kept open to ensure that the content of the sheet is not edited from the screen where the modal box is open.

The last instruction in the script is to close the modal dialog box, thereby enabling the editing of the sheet again.

Bug reported to Google here.


Solution

  • I opened a ticket with google on this issue (https://issuetracker.google.com/issues/356297568) and now the code works as before 26072024.