Google Spreadsheets timestamp

by ibkid   Last Updated April 15, 2019 06:03 AM

I'm trying to have a timestamp automatically appear in column L (12) in a Google Spreadsheet if a tick box is ticked on the same row (in column A). The app script code that I modified from this source keeps giving me undefined in the cell in column L if I tick the tick box in the same row (column A). I would appreciate any help to fix the problem.

(I know that there are a lot of questions about timestamps here on StackExchange but I'm a newbie and can't get it to work for my situation).

function onEdit() {
 var s = SpreadsheetApp.getActiveSheet();
 if( s.getName() == "Chemistry HL" ) { //checks that we're on the correct sheet
   var tickBox = s.getActiveCell();
   if( tickBox.getColumn() == 1 ) { //checks the tick box column
     var timeStamp = tickBox.offset(0, 11); //offset from tick box column to timestamp column
     if( tickBox == true ) //is ticked or not?
     var time = Utilities.formatDate(new Date(), "GMT-7", "yy/MM/dd");

Related Questions

Updated March 25, 2018 11:03 AM

Updated July 04, 2018 22:03 PM

Updated November 27, 2018 16:03 PM

Updated March 01, 2019 17:03 PM