title: How to (from a Google Spreadsheet) get the ID of a linked form
body: <p>I have a Google Spreadsheet that a form is linked to and all form responses are stored in.  What I am trying to find is the ID of the FORM itself.  I tried this but this does not work..</p>
  
  <p>(I'm running the following code FROM The script editor IN the spreadsheet that the form is linked to.)</p>
  
  <pre><code>function getID()
  {
   var form = FormApp.getActiveForm();
   var formID = form.getId();
   Logger.log(formID);
  }
  </code></pre>
  
  <p>That returns NULL since the script is container-bound to the spreadsheet itself.  Is there any other way to get the ID of the linked form or even the URL of the linked form?</p>
  
  <p>I can MANUALLY get it by doing the following from the Spreadsheet.
  Form > Edit form
  This will show me the URL.</p>
  
  <p>IF I knew the NAME of the form I could get it by name using the DriveApp.getFilesByName(), iterate through it and then use the File.getId() but I don't necessarily know the name.</p>
  
  <p>Any ideas?</p>