title: How do you get URL parameters in a Google Form using Google Apps Script?
body: <p>So I've got a Google Form where I'd like to pass in a parameter from an email link like this:</p>
  
  <blockquote>
    <p><a href="https://docs.google.com/URL/forms/d/LONGSTRING/viewform?id=12345">https://docs.google.com/URL/forms/d/LONGSTRING/viewform?id=12345</a></p>
  </blockquote>
  
  <p>I'd like to be able to grab that id and pass it into the spreadsheet recording results. Now I've got writing to a spreadsheet down, but getting the id is problematic.</p>
  
  <p>I've already tried:</p>
  
  <pre><code>function doGet(e) {
    var id = e.parameter.id;
    Logger.log(id);
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>function doPost(e) {
   var id = e.parameter.id;
   Logger.log("do post " + id);
  }
  </code></pre>
  
  <p>Both of which throw errors when I view the execution transcript, which I suspect is because they're designed to run within deployed webapps.</p>
  
  <p>Additionally, I've tried using plain old javascript to do something like:</p>
  
  <pre><code>var formUrl = window.location.href;
  var formId = formUrl.split('?id=')[1];
  </code></pre>
  
  <p>which also throws errors when you view the execution transcript .</p>
  
  <p>Any other ideas?? Maybe I can get the information in another way?</p>