I have a small script that I have further reduced for the sake of this question. Basically it implements the onEdit
function in which it may show an alert (using SpreadsheetApp.getUi().alert()
) and will always show a message box (using Browser.msgBox()
).
function onEdit(e) {
const rg = e.range;
// Do some stuff on rg and show alert if some condition is met.
SpreadsheetApp.getUi().alert('Alert text!');
var confirm = Browser.msgBox('Confirm','Are you sure?', Browser.Buttons.OK_CANCEL);
if (confirm != 'ok') {
return;
}
// Do some stuff.
}
The problem is the alert and message box are not working from Android app which compromises the whole function execution and the wanted changes do not happen. So I would like to detect if the sheet is opened from the Android app and if so skip showing the alert and message box but if a desktop browser is used, I still would like to show them.
I have browsed through the Script Services menu at Apps Script API but I did not find anything that could be used.