In a particular cell of a column, I would like to have a timestamp of the last date any cell of that column was modified. Specifically: G31 would show a date of last modification on any cell of the G column.
My question is quite similar to this one, but I can't seem to apply it to my situation :
Auto-updating column in Google Spreadsheet showing last modify date
I have tried this :
function onEdit()
{ var DEVIS_COMPLET_2018 = "MySheet";
var s = SpreadsheetApp.getActiveSheet();
if (s.getName() !== DEVIS_COMPLET_2018) return;
var r = s.getActiveCell();
if( r.getColumn() != G ) { //checks the column
var row = r.getRow();
var time = new Date();
time = Utilities.formatDate(time, "GMT-08:00", "MM/DD/yy");
SpreadsheetApp.getActiveSheet().getRange('G31').setValue(time); }; };
I don't get any error message but nothing happens.
I have tried enclosing G, still no luck :
function onEdit() {
var DEVIS_COMPLET_2018 = "MySheet";
var s = SpreadsheetApp.getActiveSheet();
if (s.getName() !== DEVIS_COMPLET_2018) return;
var r = s.getActiveCell();
if( r.getColumn() != "G" ) { //checks the column
var row = r.getRow();
var time = new Date();
time = Utilities.formatDate(time, "GMT-08:00", "MM/DD/YY");
SpreadsheetApp.getActiveSheet().getRange("G31").setValue(time); }; };
r.getColumn() != G
As G is not quote enclosed it's considered a variable name but it's not defined.