Drop down menu 带有SandBoxMode.IFRAME的html下拉列表

Drop down menu 带有SandBoxMode.IFRAME的html下拉列表,drop-down-menu,google-apps-script,google-sheets,Drop Down Menu,Google Apps Script,Google Sheets,我正在尝试编写一段代码(很抱歉丢失了到原始的链接),但我正在努力,无法通过错误消息“脚本已完成,但返回值不是受支持的返回类型”。我已经考虑过将其更改为字符串,但老实说,我已经无法理解我要做的事情了。非常感谢您的帮助 代码G.gs是: function getMenu1() { var t = HtmlService.createTemplateFromFile('myForm'); t.data = SpreadsheetApp .openById('11_3xQkJdQ17

我正在尝试编写一段代码(很抱歉丢失了到原始的链接),但我正在努力,无法通过错误消息“脚本已完成,但返回值不是受支持的返回类型”。我已经考虑过将其更改为字符串,但老实说,我已经无法理解我要做的事情了。非常感谢您的帮助

代码G.gs是:

function getMenu1() {
  var t = HtmlService.createTemplateFromFile('myForm');
  t.data = SpreadsheetApp
      .openById('11_3xQkJdQ172_97LWUoOu22qUMBS-vSrr7TN9bqWicg')
      .getSheetByName('PROJECTS')
      .getRange('D:D')
      .getValues();
  return t.evaluate().setSandboxMode(HtmlService.SandboxMode.IFRAME);

  Logger.log('doGetMenu1 ran');
}
而myform.html是:

<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
    <body style="font-family: Arial, Helvetica, sans-serif">

      <div>
        <input class="left" type="text" name="cuStaff" id="cuStaff" style="width=150px" required>
          <datalist id="cuStaff">
          </datalist>

        <input class="left" type="date" name="dateA" id="dateA" style="width:150px" required>
        <input class="left" type="time" name="timeA" id="timeA" style="width:75px" required>

      </div>



    </body>

<select id="cuStaff">
  <option> Choose a option </option>
</select >

<body onload = "addList()"></body>

<script>
  function addList() {
    console.log('addList ran!');

    google.script.run
      .withFailureHandler(onFailure)
      .withSuccessHandler(injectMyContent)
      .getMenu1();
  };

  window.injectMyContent = function(argReturnedData) {
    for(var i = 0; i < argReturnedData.length; i++) {
      var opt = argReturnedData[i];
      var document = myForm.html
      var el = document.createElement("option");
      var el = document
      el.text = opt;
      el.value = opt;
      select.appendChild(el);
    };
  };

  window.onFailure = function(err) {
    alert('There was an error! ' + err.message);
  };

</script >

  </head>
</html>

选择一个选项
函数addList(){
log('addList run!');
google.script.run
.withFailureHandler(onFailure)
.使用SuccessHandler(injectMyContent)
.getMenu1();
};
window.injectMyContent=函数(argReturnedData){
对于(变量i=0;i

这两种功能似乎是混合的。尝试:

函数doGet(){
var t=HtmlService.createTemplateFromFile('myForm');
返回t.evaluate().setSandboxMode(HtmlService.SandboxMode.IFRAME);
}
函数getMenu1(){
var数据=电子表格应用程序
.openById('11_3xQkJdQ172_97lwoou22qumbs-vSrr7TN9bqWicg')
.getSheetByName(“项目”)
.getRange('D:D')
.getValues();
Logger.log('getMenu1已运行')
返回数据;
}

这两个函数似乎是混合的。尝试:

函数doGet(){
var t=HtmlService.createTemplateFromFile('myForm');
返回t.evaluate().setSandboxMode(HtmlService.SandboxMode.IFRAME);
}
函数getMenu1(){
var数据=电子表格应用程序
.openById('11_3xQkJdQ172_97lwoou22qumbs-vSrr7TN9bqWicg')
.getSheetByName(“项目”)
.getRange('D:D')
.getValues();
Logger.log('getMenu1已运行')
返回数据;
}

感谢您回答Bryan P。这是在控制台显示脚本导航,记录器捕获“getMenu1 ran”时做的事情,但现在它说“数据”未定义“抱歉,Bryan P,我有一个输入错误。即从电子表格中提取数据并在日志中显示。它并没有把它推到另一边。客户端下拉列表,但我会处理它,看看是否可以破解。尝试将
window.injectMyContent=function
更改为
function injectMyContent
感谢您回答Bryan P。这是在控制台显示脚本导航和记录器捕获“getMenu1 run”时做的事情,但现在已经完成了说“数据”没有定义“对不起,Bryan P,我打错了。即从电子表格中提取数据并在日志中显示。它并没有把它推到另一边。客户端下拉列表,但我会处理它,看看是否可以破解。尝试将
window.injectMyContent=function
更改为
function injectMyContent