Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google apps script 试图在谷歌网站上创建谷歌工作表搜索框_Google Apps Script_Google Sites - Fatal编程技术网

Google apps script 试图在谷歌网站上创建谷歌工作表搜索框

Google apps script 试图在谷歌网站上创建谷歌工作表搜索框,google-apps-script,google-sites,Google Apps Script,Google Sites,我收到以下错误:无法从undefined读取属性“searchtext” 有人能帮忙吗?我是个新手,正在使用教程 也许你忘了把e作为doGet的参数。您如何调用getData(e)?我看到您正在使用~。你知道它是什么意思吗?你也应该包括你的HTML代码,你当前如何调用这个函数,你的目标用户将如何调用这个函数。 function doGet() { return HtmlService.createTemplateFromFile('index').evaluate(); } functi

我收到以下错误:无法从undefined读取属性“searchtext”


有人能帮忙吗?我是个新手,正在使用教程

也许你忘了把e作为doGet的参数。您如何调用getData(e)?我看到您正在使用
~
。你知道它是什么意思吗?你也应该包括你的HTML代码,你当前如何调用这个函数,你的目标用户将如何调用这个函数。
 function doGet() {
  return HtmlService.createTemplateFromFile('index').evaluate();
}

function getData(e) {
  var id = "1v_B85_8w_7Giry8DH-zM__v9c3BJYA-XPTcz9YwiktQ";
  var sheetname = "Sheet1";
  var data = SpreadsheetApp.openById(id).getSheetByName(sheetname).getDataRange().getValues();
  var ar = [];
 data.forEach(function(f) {
    if (~f.indexOf(e.searchtext)){
      ar.push(f);
    }
  });
  return ar;
}