I'm trying to make a Y/N popup box appear when you open the sheet3 on a Googlesheet file. So far I have this code:
function onOpen() {
var ui = SpreadsheetApp.getUi();
var result = ui.alert(
'Please confirm',
'Have you sorted the Calculations Page?',
ui.ButtonSet.YES_NO);
// Process the user's response.
if (result == ui.Button.YES) {
// User clicked "Yes".
ui.alert('Thank you, you may continue.');
} else {
// User clicked "No" or X in the title bar.
ui.alert('Please sort the Order Number column.');
}
}
But with this code, it applies when I open the document, and only when I open the document. I'd like it so the box appears when I open the sheet3 tab. Extra points if there is a way to take me to sheet2 if you click 'No' on the box!