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

211
Visualizações
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 à 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