Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function onOpen() {
- SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
- .createMenu('Custom Menu')
- .addItem('Show alert', 'showAlert')
- .addToUi();
- }
- function showAlert() {
- var ui = SpreadsheetApp.getUi(); // Same variations.
- var result = ui.alert(
- 'Please confirm',
- 'Are you sure you want to continue?',
- ui.ButtonSet.YES_NO);
- // Process the user's response.
- if (result == ui.Button.YES) {
- // User clicked "Yes".
- ui.alert('Confirmation received.');
- function skickaemail() {
- var file = DriveApp.getFileById('1gVPWRMEmJ68CxY1PKvwS-oPXVbteu7bvOCnQlZHPYsg');
- MailApp.sendEmail('email@email.se', 'försättsblad avtal', 'se bifogat innehåll.', {
- name: 'Automatic Emailer Script',
- attachments: [file.getAs(MimeType.PDF)]
- });
- }
- } else {
- // User clicked "No" or X in the title bar.
- ui.alert('Permission denied.');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement