Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. function onOpen() {
  2. // Add a custom menu to the spreadsheet.
  3. SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
  4. .createMenu('Custom Menu')
  5. .addItem('myToDoPanelLabel', 'showTestPanel')
  6. .addToUi();
  7. }
  8.  
  9. function insert(value) {
  10. SpreadsheetApp.getUi().alert("Message"); //with this line it only works in test sheet but not in the original sheet
  11. var thisID="1Mv-0YRSJJpwSaRh_xAeZDtVqL-P-e5nS80fUJIq_CJ4";
  12. var ss = SpreadsheetApp.openById(thisID).getSheetByName("Tab1");
  13. ss.getRange(1,2).setValue("New Txt");
  14.  
  15. }
  16.  
  17.  
  18. function showTestPanel() {
  19. var template = HtmlService.createTemplateFromFile('panel');
  20. var htmlOutput = template.evaluate()
  21. .setTitle('ToDoPanel');
  22. SpreadsheetApp.getUi().showSidebar(htmlOutput);
  23. }
  24.  
  25. <script>
  26. window.mark = function() {
  27. google.script.run.insert();
  28. };
  29. </script>
  30.  
  31. <button onclick='mark()'>click me</button>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement