Salar
Salar

Reputation: 5509

google sheets use named range inside custom function

I have defined a custom function like below. I want to use a named range in it but I keep getting the error that the named range is not defined. I tried to use INDIRECT function, but INDIRECT is also not recognized.

function RetentionCalculatorV1(x) {
  return x* INDIRECT("V1.RetentionRateFrom1MonthAgo");

}

Upvotes: 0

Views: 79

Answers (1)

idfurw
idfurw

Reputation: 5862

Spreadsheets functions are not available in Google Apps Script.

Try

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

Upvotes: 1

Related Questions