Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

146
Views
Obtener una hilera inicial con e.range

Estoy usando un script en Hojas de cálculo de Google que crea una marca de tiempo en una celda cuando se establece el valor de la celda contigua. Borra la fecha si se borra el valor de la celda de al lado.

Sin embargo, está afectando a toda la hoja. Solo quiero que este código funcione a partir de la fila 18.

Soy muy nuevo en la codificación. He investigado un poco, pero todavía no puedo resolverlo. Tengo una variable definida llamada StartRow e intenté usarla en mi instrucción if y luego en mi ciclo en lugar de "e.range.rowStart" , pero activó la fecha varias veces hacia arriba.

¿Puede alguien darme su opinión sobre lo que debo cambiar o agregar? ¡Gracias por adelantado!

Aquí está el código que estoy usando:

 function onEdit(e) { var sheet = ["Sheet1"]; var ss = SpreadsheetApp.getActiveSheet(); var StartRow = 18; //(defined but not sure where or if I should use it) var InputCol = 6; var OutputCol = 7; if (sheet.indexOf(ss.getName()) == -1 || e.range.columnStart != InputCol) return; var val = ss.getRange(e.range.rowStart, e.range.columnStart).getValue(); if (val) { var date = new Date(); for (var i = e.range.rowStart; i <= e.range.getLastRow(); i++) ss.getRange(i, OutputCol).setValue(date); } else ss.getRange(e.range.rowStart, OutputCol, e.range.getLastRow() - e.range.rowStart + 1).clearContent(); }

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Prueba esto:

 function onEdit(e) { //e.source.toast('entry'); const sh = e.range.getSheet(); if (sh.getName() == 'Sheet1' && e.range.rowStart > 18 && e.range.columnStart == 6) { if (e.value) { e.range.offset(0, 1).setValue(new Date()); } else { e.range.offset(0, 1).setValue(''); } } }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!