Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. function onOpen() {
  2. SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
  3. .createMenu('Custom Menu')
  4. .addItem('Show alert', 'showAlert')
  5. .addToUi();
  6. }
  7.  
  8. function showAlert() {
  9. var ui = SpreadsheetApp.getUi(); // Same variations.
  10.  
  11. var result = ui.alert(
  12. 'Please confirm',
  13. 'Are you sure you want to continue?',
  14. ui.ButtonSet.YES_NO);
  15.  
  16. // Process the user's response.
  17. if (result == ui.Button.YES) {
  18. // User clicked "Yes".
  19. ui.alert('Confirmation received.');
  20. function skickaemail() {
  21. var file = DriveApp.getFileById('1gVPWRMEmJ68CxY1PKvwS-oPXVbteu7bvOCnQlZHPYsg');
  22. MailApp.sendEmail('email@email.se', 'försättsblad avtal', 'se bifogat innehåll.', {
  23. name: 'Automatic Emailer Script',
  24. attachments: [file.getAs(MimeType.PDF)]
  25. });
  26. }
  27. } else {
  28. // User clicked "No" or X in the title bar.
  29. ui.alert('Permission denied.');
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement