Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/6.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 GetDataRange";“失败”;或;超时“;_Google Apps Script_Google Sheets - Fatal编程技术网

Google apps script GetDataRange";“失败”;或;超时“;

Google apps script GetDataRange";“失败”;或;超时“;,google-apps-script,google-sheets,Google Apps Script,Google Sheets,下午好 我有一个web应用程序,我决定对脚本进行一些更改,但这并没有按计划进行 目标:1)从工作表中获取数据,2)从工作表上的范围获取数据 例如:从B1:E500范围内的“项目”表中获取数据,我尝试了“和”,因为不确定应该是什么,但不管有什么错误和任何帮助都将不胜感激 下面是我的代码,但每次运行它时,我都会在Google Dashboard中看到一个错误 “失败”或“超时” 根据Cooper的指导,我需要使用getRange(),这起到了作用。出现了什么错误?“失败”或“超时GetDataRan

下午好

我有一个web应用程序,我决定对脚本进行一些更改,但这并没有按计划进行

目标:1)从工作表中获取数据,2)从工作表上的范围获取数据

例如:从B1:E500范围内的“项目”表中获取数据,我尝试了“和”,因为不确定应该是什么,但不管有什么错误和任何帮助都将不胜感激

下面是我的代码,但每次运行它时,我都会在Google Dashboard中看到一个错误

“失败”或“超时”


根据Cooper的指导,我需要使用getRange(),这起到了作用。

出现了什么错误?“失败”或“超时GetDataRange()不接受参数,请改为尝试getRange()
function doGet(e) {

if ( e.parameter.func == "static" ) {
  var ss = SpreadsheetApp.getActive();
  var shProj = ss.getSheetByName("Projects").getDataRange('B1:E500').getValues();
  var shHier = ss.getSheetByName("Hierarchy").getDataRange('B1:F2000').getValues();
  var shFlr = ss.getSheetByName("Floors").getDataRange('B1:C300').getValues();
  var shRm = ss.getSheetByName("Rooms").getDataRange('B1:C500').getValues();
  var shCnd = ss.getSheetByName("Condition").getDataRange('B1:C50').getValues();
  var shSts = ss.getSheetByName("Status").getDataRange('B1:C50').getValues();
  var shRfg = ss.getSheetByName("Refrigerant").getDataRange('B1:C300').getValues();
  var shAcs = ss.getSheetByName("AccessE").getDataRange('B1:C50').getValues();
  
  return ContentService.createTextOutput(JSON.stringify({"Projects":shProj,"Hierarchy":shHier,"Floors":shFlr,"Rooms":shRm,"Condition":shCnd,"Status":shSts,"Refrigerant":shRfg,"AccessE":shAcs,})).setMimeType(ContentService.MimeType.JSON);
}