引用来自单元格的数据然后为其添加时间戳

Reference data from cell then timestamp it

我目前正在使用 Sheetgo 为数据添加时间戳。不幸的是,我的试用期即将到期。我假设带有触发器的脚本会为我提供相同的结果,但我不确定如何去做。

我正在从 api 中提取值“A1”:

Sheetgo 然后每小时在单独的 sheet 上记录值:

对于创建可以执行此任务的 script/trigger 的任何帮助,我们将不胜感激。谢谢

每小时记录一个值

function getA1() {
  const ss = SpreadsheetApp.getActive();
  const sh = ss.getSheetByName("Sheet0");//wherever the data is
  const A1 = sh.getRange("A1").getValue();//wherever the data is
  ss.getSheetByName("log").appendRow([A1,new Date()]);
}

运行以下至少一次

function ctrig() {
  if(ScriptApp.getProjectTriggers().filter(t => t.getHandlerFunction() == "getA1").length == 0) {
    ScriptApp.newTrigger("getA1").timeBased().everyHours(1).create();
  }
}

Script App newTrigger