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

320
Vistas
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 Respuestas
Responde la pregunta

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 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