title: Creating Forms Through Google App Script - Pulling Images Dynamically
body: <p>The forms function used to generate items in a form seems to work dynamically for everything but images.  For generating a video in the form, this is the format used, pulling data dynamically from a spreadsheet.</p>
  
  <pre><code>    var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("makechoice");
  
      var dataRange = ss.getRange(2,1,40,20);
      var data = dataRange.getValues();
  
  
      var form = FormApp.create("Make a Test");  
      for (i in data) {
      var row = data[i];
      var qst = row[2];
      var url  = row[8];
  
      if (word == "Video") { form.addVideoItem()
                             .setTitle(qst)
                             .setHelpText(qst)
                             .setVideoUrl(url);
                           }
  </code></pre>
  
  <p>This works fine.  However, the example given for images is as follows.</p>
  
  <pre><code>    var img = UrlFetchApp.fetch('http://www.example.com');
      form.addImageItem()
              .setTitle('Title')
              .setHelpText('Description') // The help text is the image description
              .setImage(img);
  </code></pre>
  
  <p>This does not allow anything other than a url to be used with the "fetch" function!  Therefore, I'm only able to use one static url to get it work, but it can't pull from a cell in the spreadsheet like it would with the video example.  Is there a way around this?  I'd like this to generate multiple image items in the form dynamically and in the loop.</p>