title: Google Apps Script - get URL of File in Drive with File Name
body: <p>I am attempting to create a form in Google Spreadsheets which will pull an image file from my Drive based on the name of the file and insert it into a cell.  I've read that you can't currently do this directly through Google Scripts, so I'm using setFormula() adn the =IMAGE() function in the target cell to insert the image.  However, I need the URL of the image in order to do this.  I need to use the name of the file to get the URL, since the form concatenates a unique numerical ID into a string to use the standardized naming convention for these files.  My issue is that, when I use getFilesByName, it returns a File Iteration, and I need a File in order to use getUrl().  Below is an snippet of my code which currently returns the error "Cannot find function getUrl in object FileIterator."</p>
  
  <pre><code>  var poNumber = entryFormSheet.getRange(2, 2);
    var proofHorizontal = drive.getFilesByName('PO ' + poNumber + ' Proof Horizontal.png').getUrl();
  
    packingInstructionsSheet.getRange(7, 1).setFormula('IMAGE(' + proofHorizontal + ')');
  </code></pre>