Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

379
Views
Is this possible to do with RangeNames in GSheet Appscript? I get this error: "TypeError: sheet.getRangeByName is not a function"

I am trying to add some static range names to an object in AppScript, I do this to have more flexibility since there are more than 20 variables (columns) and so that if you try to add a column in the google sheet, the code is not damaged, this is a simplified example of what I already have coded:

var sheet = SpreadsheetApp.getActive().getSheetByName('Form Responses');

var bot_id = sheet.getRangeByName("bot_id");

var elements = {
  bot_id: bot_id,
}

var res = elements.bot_id.getValues();

However, when I run it I get the following error: "TypeError: sheet.getRangeByName is not a function".

How can I fix it and always be referencing to the same sheet, is there another easier and more efficient way to do it?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

getRangeByName() is not a method of Sheet but instead of Spreadsheet. So you should try:

var bot_id = SpreadsheetApp.getActiveSpreadsheet().getRangeByName("bot_id");
about 4 years ago · Juan Pablo Isaza Report

0

Try it this way:

function lfunko() {
  const ss = SpreadsheetApp.getActive()
  const sh = ss.getSheetByName('Sheet0');
  var bot_id = ss.getRangeByName("bot_id");
  Logger.log(JSON.stringify(bot_id.getValues()));
}
  • getRangeByName()
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!