Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

419
Vistas
Can I get name of cell by range in app script google sheet

I have code to calculate two cells by formula this is my code :

function myFunction() {
     var ss = SpreadsheetApp.getActiveSpreadsheet();
     var sh = ss.getSheetByName("sheet29");
     var maxR = sh.getMaxRows();

     var first = sh.getRange(maxR,6,1);
     var second = sh.getRange(maxR,7,1);

     var calculate = sh.getRange(maxR,8,1);

     first.setValue("2");
     second.setValue("2");

     var q = "F6"; // I want to change it to some thing like var q = first...;
     var qq =  "G6"; // I want to change it to some thing like var q = second...;

     var formula= ("=sum("+q+"+"+qq+")");
     calculate.setValue(formula);
 }

This code is fine calculate by formula by this code

var formula= ("=sum("+q+"+"+qq+")");
calculate.setValue(formula);

what I need, I don't know what is the name of cells to calculate, this dynamic. Any way to find the name of cell by range or another method

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can get the A1 notation of a range by using range.getA1Notation() method and use it to set formula. Change your code

From:

 var q = "F6";
 var qq =  "G6";

To:

 var q = first.getA1Notation();
 var qq =  second.getA1Notation();

Reference:

  • Range.getA1Notation()
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda