title: Populating radio buttons from google sheets into HTML
body: <p>I have a google sheets field that will have a yes or no value. When I render an HTML form that I use I want to populate the <strong>"checked"</strong> value on the HTML input tag based on what is in the google sheets but cannot seem to get the HTML and script to work so any help is greatly appreciated. </p>
  
  <p>Here is what I have :</p>
  
  <p>In the google app script I have a function to show the HTML form </p>
  
  <pre class="lang-js prettyprint-override"><code>var html = HtmlService.createHtmlOutputFromFile("addUserLeadScore").setWidth(500).setHeight(550);
  </code></pre>
  
  <p>In the HTML file I load the form and call the getData function</p>
  
  <pre class="lang-js prettyprint-override"><code>window.onload = function LoadFormWithData()
          {
            google.script.run.withSuccessHandler(showData).getData();
          }
  </code></pre>
  
  <p>Here is the getData</p>
  
  <pre class="lang-js prettyprint-override"><code>function getData(){
      var ss = SpreadsheetApp.getActive();
      var sheet = ss.getSheetByName("Template");
      var data = sheet.getRange(iRow, iCol, iNumRows, iNumCols).getValues(); 
      return data;
  }
  </code></pre>
  
  <p>And here is the HTML to build the radio buttons</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;div id="firstAndLast"&gt;&lt;/div&gt;
  &lt;td id="firstAndLastTd"&gt;
      &lt;center&gt;Prospect provided a first &lt;b&gt;AND&lt;/b&gt; last name &lt;/center&gt;           
      &lt;input type="radio" name="firstAndLast" value="Yes"&gt; Yes &lt;br&gt;
      &lt;input type="radio" name="firstAndLast" value="No"&gt; No &lt;br&gt;
  &lt;/td&gt; 
  </code></pre>
  
  <p>But how do I do it so that if data[0][1] = "yes" :  </p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;input type="radio" name="firstAndLast" value="Yes" checked&gt;
  </code></pre>
  
  <p>instead of </p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;input type="radio" name="firstAndLast" value="Yes" checked&gt;
  </code></pre>