title: Passing and using a parameter in Google Apps Script Web App
body: <p>Imagine this scenario. I have a google spreadsheet with various columns. The first column is called ID. This spreadsheet is updated from a Google Calendar (using Google Apps script and the Google Calendar API) on a timer basis (e.g. every 5 minutes). The ID identifies the calendar entry. The user creating the entry, at the point of the record being appended to the spreadsheet, should receive an email with a link to a form, with the ID being passed as parameter. This form consists of some further advanced details not offered by the Google Calendar out-of-the-box functionality. The user will then fill in the form, and the relevant row should be updated in the spreadsheet according to the user's selection.</p>
  
  <p>My plan is to create an Apps Script project within the Google Spreadsheet, and load an HTML page using the Html Service. On submitting of the form, the user selection will be used in the App script to update the Google spreadsheet. What I cannot figure out is the logic behind passing the ID (reference) to the spreadsheet row to be updated. Can it be done? In a normal HTML scenario, I would append a parameter to the URL dynamically, and then use Javascript to extract the parameter from the query string. In the case of a deployed web app, I have no idea what to do. </p>
  
  <pre><code>function doGet() {
      var template = HtmlService.createTemplateFromFile('index');
      return template.evaluate().setSandboxMode(HtmlService.SandboxMode.IFRAME);
  }
  
  function updateSpreadsheet(input1, input2) {
      return "ok";
  }
  </code></pre>
  
  <p>The deployed app script in a web app link would look something like: </p>
  
  <pre><code>https://script.google.com/a/domain.com/macros/s/Adlksjflf09_LEg8kdlf9/exec?ID=1
  </code></pre>
  
  <p>where ID = 1 refers to the ID of the calendar as recorded within the Google Spreadsheet.</p>
  
  <p>The doGet() function would be used to retrieve the ID and use it in the updateSpreadsheet() function to update the relevant record in the spreadsheet (implementation to update the spreadsheet still to be done).</p>
  
  <p>Any idea how to pass the parameter to the web app and actually use it? Furthermore, if my reasoning is wrong or there is a better way about it kindly let me know ! Thanks for your help, in advance.</p>