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

322
Visualizações
clear a cell based on the contents of another cell

I have on a google spreadsheet on the sheet "SUIVI ANIM", a column Y whose each cell contains from line 5, a drop-down menu. Then I have in column Z a small "x". I would like that when in column Y, it is "Submit LEAD" which is selected that automatically the small "x" of column Z is erased. For example, if "Submit LEAD" in Y3 then Z3 is empty. If "Submit LEAD" in Y4 then Z4 empties etc.

I searched and found this script:

function onEdit(e) {

  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getActiveSheet();
  
  // identify the range and values to watch and clear
  var watchCol = 25; // Column Y
  var watchValue = "Submit LEAD";
  var clearCol = 26; // Column Z
  // 

  // Logger.log("DEBUG: the column = "+e.range.columnStart+", and the value = "+e.value)
  if (e.range.columnStart === watchCol && e.value === watchValue) {
    // Logger.log("DEBUG: the conditions were met");   
    sheet.getRange(e.range.rowStart, clearCol).clearContent()
  }
  return false;
}

But it doesn't work and the debug tells me it's wrong from the line: if (e.range.columnStart === watchCol && e.value === watchValue) {

I'm new to scripting and I'm French so sorry if I'm not very clear.

Thanks for any help you could give me. émilie

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You cannot return anything to a trigger

function onEdit(e) {
  var sh = e.range.getSheet();
  if (e.range.columnStart == 25 && e.value == "Submit LEAD") {
    sheet.getRange(e.range.rowStart, 26).clearContent();
  }
}

Normally people put a sheet name in the conditional so that it only runs on selected sheets.

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