从Google Sheet到HTML的变量添加

时间:2017-06-28 03:13:12

标签: javascript html

我有一个正在处理的项目,我需要一个html页面,弹出一个学生的姓名和身份证号码。它应该从谷歌电子表格中提取数据,并在测试时显示在空白处。我已经仔细检查过我正在引用正确的纸张和范围。有想法该怎么解决这个吗?谢谢!



<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
    <link rel="stylesheet" href="https://ssl.gstatic.com/docs/script/css/add-ons1.css">
    <script>
    window.onload = "google.script.run.dataPullOne()"
    function dataPullOne(){    
      var firstName = SpreadsheetApp.openById('SheetID').getSheetByName('High School Teacher and Email List').getRange(30, 11).getValue()
      var lastName = SpreadsheetApp.openById('SheetID').getSheetByName('High School Teacher and Email List').getRange(31, 11).getValue()
      var id = SpreadsheetApp.openById('SheetID').getSheetByName('High School Teacher and Email List').getRange(32, 11).getValue()
    document.getElementById('name').innerHTML = firstName+' '+lastName;
    document.getElementById('id').value = id;
};
    </script>
  </head>
  <body>
    <p><img style="float: right;" src="http://gdurl.com/7Azn" alt="FANS Logo" width="150" height="150" /></p>
    <b>Awesome!</b>
    <p>I was able to find one match in the system. I just want to confirm, I should remove this student correct?</p>
    <p>Student name:</p>
    <input type="hidden" id="name" value="" />
    <p>ID:</p>
    <input type="hidden" id="id" value="" />
    <p id = "idD"></p>
    <div>
    <input type="button" value="Correct" 
        onclick="google.script.run.removeByIDFour()" />
        </div>
        <p></p>
        <div>
    <input type="button" value="Try Again"
        onclick="google.script.run.removeByIDTwo()"/>
        </div>
        <p></p>
        <div>
    <input type="button" value="Exit"
        onclick="google.script.host.close()"/>
        </div>
        <p></p>
        <p class="secondary" style="text-align: right;">Version 2.0</p>
  </body>
</html>
&#13;
&#13;
&#13;

0 个答案:

没有答案