title: Pass variable between two functions
body: <p>I want to write a app which generates a spreadsheet in my google-drive with the user input data with google-app scripts.</p>
  
  <p>For doing so I have several JavaScript-functions I want to execute one after the other:</p>
  
  <pre><code>function createSpreadsheet(name){
  
    var ss=SpreadsheetApp.create(name);
    var ssID = ss.getID()
  
  }
  
  function writeData(data){
  
    var s = ss.getSheets()[0];
    s.getRange('A1').setValue(data);
  
  }
  </code></pre>
  
  <p>which are called by the frond-end script via:</p>
  
  <pre><code> &lt;script&gt;
  
    function parse_to_backend(){
  
        var name = document.getElementById("user_name").value;
        var data = document.getElementById("user_data").value;
  
        google.script.run.createSpreadsheet(name);
        google.script.run.writeData(data);
  
    };
  
    &lt;/script&gt; 
  </code></pre>
  
  <p>how can I achieve that the writeData knows ssID the ID of the spreadsheet <s>(I can not return values to the frontend with google.script.run and parse it as an argument)</s>?</p>