C
C
carter19832021-05-06 17:52:30
Google Sheets
carter1983, 2021-05-06 17:52:30

How to create a script to automatically fill in the date when changing in the adjacent cell?

There is a sheet of the Google table, where the column "c" is filled with hands. We need a script that tracks changes in the cells of the "c" column, which will return the value of the current date to the cell of the neighboring column "d". I can not adapt the scripts that I found because the noob in this matter. Help me please.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arabar, 2021-05-11
@carter1983

function onEdit(e){
  var range = e.range;
  if(range.getColumn() === 3){
    let dat = new Date();
    SpreadsheetApp.getActiveSheet().getRange(range.getRow(), 4).setValue(Utilities.formatDate(dat, "GMT+3", "dd.MM.yyyy"));
  }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question