Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function onOpen() {
- // Add a custom menu to the spreadsheet.
- SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
- .createMenu('Custom Menu')
- .addItem('myToDoPanelLabel', 'showTestPanel')
- .addToUi();
- }
- function insert(value) {
- SpreadsheetApp.getUi().alert("Message"); //with this line it only works in test sheet but not in the original sheet
- var thisID="1Mv-0YRSJJpwSaRh_xAeZDtVqL-P-e5nS80fUJIq_CJ4";
- var ss = SpreadsheetApp.openById(thisID).getSheetByName("Tab1");
- ss.getRange(1,2).setValue("New Txt");
- }
- function showTestPanel() {
- var template = HtmlService.createTemplateFromFile('panel');
- var htmlOutput = template.evaluate()
- .setTitle('ToDoPanel');
- SpreadsheetApp.getUi().showSidebar(htmlOutput);
- }
- <script>
- window.mark = function() {
- google.script.run.insert();
- };
- </script>
- <button onclick='mark()'>click me</button>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement