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

203
Vistas
Copy row when cell contains "x" with another condition to meet

Spreadsheet screenshotI have a script from one of the old topics to copy row when a certain value is in a cell:

  
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var s = event.source.getActiveSheet();
  var r = event.source.getActiveRange();
  if(s.getName() == "Stock" && r.getColumn() == 4 && r.getValue() <= 5) {
    var row = r.getRow();
    var numColumns = s.getLastColumn();
    var targetSheet = ss.getSheetByName("Orders");
    var target = targetSheet.getRange(targetSheet.getLastRow() +1, 1);
    s.getRange(row, 1, 1, numColumns).copyTo(target);
  }
}

However, I need to make a thresholds for a categories. Let's say i have 2 categories in the stock: "Power Tools" and "Hand Tools". In case of Power tools i would like the script to run when the value reach 5 or less and in case of Hand Tools 10 or less. Category is set in column A and it have been set before so the trigger doesn't work when i write to conditions in the code as i changed only the amount value. Many thanks for advice!

about 4 years ago · Juan Pablo Isaza
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