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

236
Vistas
How can I manually change a cell's contents when I have a script to automatically set that cell?

I have created the below script:

function onEdit() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sh = ss.getSheetByName("Sheet1");
var cell = sh.getRange("A1:A1");
var cells = sh.getRange("B1:B1");

 if( cell.getValue() !="" ) {
 cells.setValue(new Date()); 

 }
 if( cell.getValue()==="" ) {
 cells.clearContent();
 }
}

This code can insert a new date into cell B1 when data is entered into cell A1. It can also remove the date from cell B1 when I clear the data from cell A1. But if I want to manually change the date in cell B1 when cell A1 has data entered, how can I do that?

about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

You try this function

function onEdit(e) {let cellDate=e.source.getActiveSheet().getRange('B1');
    if(e.range.getA1Notation()=='A1'&&e.source.getSheetName()=='Sheet1')
       {if(e.value==null) cellDate.clearContent();
        else cellDate.setValue(new Date());}
}

Note: This function checks if the changed cell is A1, then makes the change to B1. So you can completely change B1 after you have changed A1

about 4 years ago · Santiago Gelvez 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