title: How to call functions from gs file using HTMLService?
body: <p>This is driving me nuts. I've written a html page for my Google web app which has functions written in a .gs file. All I am trying to do is call the functions from the .gs file from the .html file. However, every method I have tried does not seem to work. I know my functions work because they work when I run just them. I am missing how to connect the .gs file to the .html file.</p>
  
  <p>my .gs file looks something like this:</p>
  
  <pre><code>function doGet() {
  
    return HtmlService.createHtmlOutputFromFile('index');
  }
  
  function test()
  {
    //getFormattedSpreadsheet("1xPDJJfCqWb2igug3NCFmJJ5nO49U6CK8mLwtaD727AY", "17qcsYh8M-cOwTg9K7sqqnKm0pGgEo6r7x1PguRf9Jk8", "Select School");
    archiveSheet("1wTNing5LAOYHbscQ_DTktIxvWcyc6gw6ZNTvAJDtkTo", "1ugNP0Pp97tnRKHLHa50j-QKx-4ynCfg3zHxtJTayiVk");
  
  }
  </code></pre>
  
  <p>I need the function to be called on a button click, I tried things like (or even without the google.script.run portion):</p>
  
  <pre><code>&lt;button onclick="google.script.run(test())"&gt;Full&lt;/button&gt;
  </code></pre>
  
  <p>but I can't get my button to actually call scripts. I've read you can call scripts to run by just putting them in function() tags as well, but I need this to run on click rather than on load. Perhaps I just don't understand the link between the .gs and .html file. They are seperate files, but within the same Google web app project. </p>