samedi 24 février 2018

Prompt message box through custom menu on Google Sheets/App Script

I have created a custom menu on Google Sheets with two options:

function onOpen(e) {
 var menu = SpreadsheetApp.getUi().createMenu('Trendtype')
 menu.addItem('Add new store', 'openForm')
 menu.addItem('Update Database', 'replacebackenddatabase') }

When a user selects "Update Database" I would like a message box to appear and ask for confirmation with "Do you want to proceed" and Yes/No basis. IF the user selects "Yes", I would like the function 'replacebackenddatabase' to run. If not, I would just like the message box to close and nothing to happen.

How can I do this? Thank you!

Aucun commentaire:

Enregistrer un commentaire