Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

415
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda