title: Display Spreadsheet Data to HTML Table
body: <p>I have a problem with my HTML Table. I want my spreadsheet data to be displayed there. I don't know what did I missed.</p>
  
  <p>This is my Code.GS:</p>
  
  <pre class="lang-js prettyprint-override"><code>function getTableData(){
    var url3 = "https://docs.google.com/spreadsheets/d/xxxxxxxxxx/edit#gid=0";
    var ss3 = SpreadsheetApp.openByUrl(url3);
    var ws3 = ss3.getSheetByName("Time");
    var data = ws3.getRange(2,2,ws3.getLastRow()-1,10).getValues();
    //Logger.log(data);
    return data;
  
  }
  </code></pre>
  
  <p>This is my Script:</p>
  
  <pre class="lang-html prettyprint-override"><code> &lt;script&gt;
  
  var data = [
      [1, "Jack",55],
      [1, "Jack",55],
      [1, "Jack",55]
  ];
  
  document.addEventListener("DOMContentLoaded", function(){
  
  google.script.run.withSuccessHandler(generateTable).getTableData();
  
  
  });
  
  function generateTable(dataArray){
  
  var tbody = document.getElementById("table-body");
  
  dataArray.forEach(function(r){
  
  var row = document.createElement("tr");
  var col1 = document.createElement("td");
  col1.textContent = r[0];
  var col2 = document.createElement("td");
  col2.textContent = r[1];
  var col3 = document.createElement("td");
  col3.textContent = r[2];
  row.appendChild(col1);
  row.appendChild(col2);
  row.appendChild(col3);
  tbody.appendChild(row);
  });
  
  }
  
  &lt;/script&gt;
  </code></pre>
  
  <p>HTML:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;table&gt;
              &lt;thead&gt;
                &lt;tr&gt;
                    &lt;th&gt;E-mail&lt;/th&gt;
                    &lt;th&gt;Case&lt;/th&gt;
                    &lt;th&gt;Assignment&lt;/th&gt;
                    &lt;th&gt;Notes&lt;/th&gt;
                    &lt;th&gt;Start Date&lt;/th&gt;
                    &lt;th&gt;Start Time&lt;/th&gt;
                    &lt;th&gt;End Date&lt;/th&gt;
                    &lt;th&gt;End Time&lt;/th&gt;
                    &lt;th&gt;Total&lt;/th&gt;
                &lt;/tr&gt;
              &lt;/thead&gt;
  
              &lt;tbody id="table-body"&gt;
               
              &lt;/tbody&gt;
              
            &lt;/table&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I almost pulled my hair off, I am frustrated. I tried everything I know but no luck. Can you help? </p>