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

377
Views
¿Es posible hacerlo con RangeNames en GSheet Appscript? Recibo este error: "TypeError: sheet.getRangeByName no es una función"

Estoy tratando de agregar algunos nombres de rango estáticos a un objeto en AppScript, hago esto para tener más flexibilidad ya que hay más de 20 variables (columnas) y si intenta agregar una columna en la hoja de Google, el código es no dañado, este es un ejemplo simplificado de lo que ya he codificado:

 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();

Sin embargo, cuando lo ejecuto, aparece el siguiente error: "TypeError: sheet.getRangeByName no es una función".

¿Cómo puedo solucionarlo y estar siempre haciendo referencia a la misma hoja, hay otra forma más fácil y eficiente de hacerlo?

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

0

getRangeByName() no es un método de Sheet sino de Spreadsheet. Así que deberías probar:

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

0

Pruébalo de esta manera:

 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())); }
  • obtenerRangoPorNombre()
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!