代码之家  ›  专栏  ›  技术社区  ›  Salar

GoogleSheets在自定义函数中使用命名范围

  •  0
  • Salar  · 技术社区  · 5 年前

    我定义了一个自定义函数,如下所示。我想在其中使用一个命名范围,但我一直得到一个错误,即命名范围没有定义。我试着用 间接的 功能,但也不承认间接功能。

    function RetentionCalculatorV1(x) {
      return x* INDIRECT("V1.RetentionRateFrom1MonthAgo");
    
    }
    
    1 回复  |  直到 5 年前
        1
  •  1
  •   idfurw    5 年前

    电子表格功能在Google应用程序脚本中不可用。

    尝试

    return x* SpreadsheetApp.getActive().getRangeByName("V1.RetentionRateFrom1MonthAgo").getValue();