P
P
paroletatel2019-02-13 00:35:18
JavaScript
paroletatel, 2019-02-13 00:35:18

Is it possible in Google Sheets to somehow capture the date a cell value was modified?

The point is that you need to know at what time the value in the cell was changed, so that when transferred to the next sheet through the filter function, the line gets to the bottom of the array, and not somewhere else.
If there is another solution to this problem, I will be glad to know.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
feyanax, 2019-02-13
@paroletatel

You just need to look at the onedit trigger, check which cell is being edited and if you need it, then simply write the date of the change in the desired cell.
look here

A
Alexander Ivanov, 2019-02-14
@oshliaer

Formulas cannot store cell state, so scripts must be used.
The general code looks like this

function myFunction(e) {

  try {
    if (!e || !e.range) return;
    if (e.range.columnStart > 1) {
      var targetCell = SpreadsheetApp.getActiveSheet()
        .getRange(e.range.rowStart, 1, e.range.rowEnd - e.range.rowStart + 1);

      /* if you want insert the date once uncomment the row below
      *
      **/
      // if(!targetCell.getValue())
      targetCell.setValue(new Date());
      
    }
  } catch (err) {
    SpreadsheetApp.getActiveSpreadsheet().toast(err.message, 'Error!!1');
  }
}

An example for testing and explanation can be found here https://gist.github.com/contributorpw/b179e819c0ee...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question