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

226
Vistas
onEdit Trigger Google Scripts

I've been working on a sheet to make a calculator that I'll use on my work, it has lots of custom functions, it's working fine. But I have like 10 functions that need to run, so I've used triggers to run those functions every time the sheet was edited. But it stopped working, and it was too resource heavy (running all the functions every time something was edited).

So how can I make a trigger function that will run one of my custom functions only if a specific cell value is edited?

In this example I want the function ifEntrada() to run when the value in cell B4 is altered:

function ifEntrada() {
  var calcular_range = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Apartamentos").getRange("B4");
  var calcular = calcular_range.getValue();
  if (calcular == "Inserir Valor Manualmente") {
    showRows_entrada_manual();
  } else {
    hideRows_entrada_manual()
  }
}

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

0

Obviously you have declared triggers observing edits on the sheet which can easily run into rate limits. You have to use the built in funcion onEdit() instead:

function onEdit(e) {
  var activeRow = e.range.getRow();
  var activeCol = e.range.getColumn();
  if (activeCol == 2 && activeRow == 4) ifEntrada();  // "2" represents the B
}

function ifEntrada() {
  var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Apartamentos');
  // do things
}

Mind that edits done over a range with the monitored cell B4 within will trigger the onEdit function only if B4 is the first cell where the edit takes effect.

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