thwippp
4/6/2018 - 2:44 PM

SideBar

/**
 * menu
 */
//function onOpen() {
//  SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
//      .createMenu('Sidebar Menu')
//      .addItem('Show sidebar', 'showSidebar')
//      .addToUi();
//}
 
/**
 * show sidebar
 */
function showSidebar() {
  var sidebarTitle = "I AM A SIDEBAR TITLE";
  var ui = HtmlService.createHtmlOutputFromFile('sidebar.html')
  .setTitle(sidebarTitle)  // Sets title
  .setSandboxMode(HtmlService.SandboxMode.IFRAME);  // Creates sandbox
    
  SpreadsheetApp.getUi().showSidebar(ui);  // Shows sidebar
}

function stub(){  // a fake function
  Browser.msgBox("hey");
  Utilities.sleep(1); 
  return "I have returned!";
}
<!DOCTYPE html>
<h1>I AM A TITLE</h1>
<input type="button" value="Close" onclick="google.script.host.close()" />

<input type="button" id="runSomethingId" value="Run something" onclick="google.script.run.stub();" />  <!-- Attach the name of your function to the button of choice -->  
<input type="button" id="runClientSideId" value="Run Clientside" onclick="a();" />  <!--Alert clientside JS function stub-->


<input type="button" id="x" value="0" onclick="set(0);" />



<!-- JQuery -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

<!-- This is for any clientside Javascript that you need to handle -->
<script>
function main(){
var zero = 0;
this.alert("0: " + zero + "1: ");
}

function set(num){
return num;
}

}


function a(){  // Clientside JS function
  this.alert("hey");
}
</script>