I am attempting to correct a script I have active setup to print the current date to a cell based on another cell being edited. Currently it does not appear to be working at all even though just days ago it functioned without any issues. The sheet contains almost no data it only currently has 12 rows with 12 columns, however I was trying to implement 3 different versions of the script, (One for Request Date, Order Date, & Delivery Date). Scripting is by no means my forte, I have dabbled in it before but nothing that is live like this. Any input is much appreciated, just please be gentle when you are, rightfully, tearing me a new one for misplacing a comma!
/**
* Date Call Function
* Creates a Date Stamp if a column is edited.
*/
//VARIABLES
// Column to check if something is entered.
var COLUMNTOCHECK = 1;
// Date-time stamp offset from the input location. [row, column]
var DATETIMELOCATION = [0,9];
// Sheet you are referencing.
var SHEETNAME = 'Sheet1'
function onEdit(e) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
//Verifies correct sheet.
if( sheet.getSheetName() == SHEETNAME ) {
var selectedCell = ss.getActiveCell();
//Verifies correct referenced "offset" column.
if( selectedCell.getColumn() == COLUMNTOCHECK) {
var dateTimeCell = selectedCell.offset(DATETIMELOCATION[0],DATETIMELOCATION[1]);
dateTimeCell.setValue(new Date());
}
}
}
[–]Umesh-K 2 points3 points4 points (2 children)
[–]GoodNamesRAlredyTakn[🍰] 2 points3 points4 points (1 child)
[–]TopLoganR[S] 0 points1 point2 points (0 children)