Set Value Of Active Cell In Google Sheets Script
I want to create a formula which creates a timestamp on a certain cell change. The code below is okay for that. What I want to do now is anchor that timestamp to the sheet by conve
Solution 1:
How about following script? When the name of function is "onEdit()", this is executed. And an edited cell of spreadsheet is changed to "date".
function onEdit(e){
var row = e.range.getRow();
var col = e.range.getColumn();
if (row == 3 && col == 3){ // You can freely define the range for putting DATE.
var timezone = "GMT+1";
var timestamp_format = "dd-MM-yyyy HH:mm:ss";
var date = Utilities.formatDate(new Date(), timezone, timestamp_format);
var col = 5; // If you want to put a value to colmun 'E' of editing cell, col is 5.
var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
ss.getRange(e.range.getRow(), col).setValue(date);
}
}
Post a Comment for "Set Value Of Active Cell In Google Sheets Script"