【发布时间】:2020-07-10 12:12:48
【问题描述】:
问题的简短描述:
当运行基于触发头时间的自动脚本时,脚本失败 带有以下错误描述
异常:范围的起始行太小。在 fetchData(wkapi2:4:20)
(这意味着工作表是空的)并且工作表不是有 300 行的情况。 它运行良好,直到 2 天前....我没有更改脚本或任何设置
当我手动运行脚本时,一切正常...
代码行如下:
function fetchData() {
var options = {'Cache-Control' : 'max-age=0, must-revalidate'}; //I've used this before to try and prevent google from giving me cached data when making API calls..seems to get the job done
var sheet = SpreadsheetApp.getActiveSheet(); //This script is bound to the corresponding sheet so we can use this conveinience method
var cell = sheet.getRange(sheet.getLastRow(),1); //Get a reference to current last cell in Column A
脚本在
sheet.getRange (... ) 自动运行时的函数
当我手动运行时,它可以工作
【问题讨论】:
-
如果工作表不为空 - 您必须在触发器上检索错误的活动工作表。您能否提供有关您的工作表、触发器以及您错过的其他相关代码部分的一些背景信息?
options的目的是什么?
标签: google-apps-script google-sheets triggers