I previously asked a two-part question, and only one part was answered and then closed, while the other part was left unanswered. I'm re-asking that part.
I'm in charge of creating an "automatic" project tracking sheet for my team. Automatic in the sense that someone presses a button, it logs a date/time stamp, and the time they spent on said project is automatically calculated for them.
However, when I connect a script to a Google Drawing to act as a button, it doesn't do anything, and I am unable to figure out why.
Here is what my spreadsheet looks like, with a button (drawing) configured to run the timeStamp()
function when clicked:
You can also get a copy of the spreadsheet here.
The code I've got so far:
function timeStamp() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
var timezone = ss.getSpreadsheetTimeZone;
var timeFormat = "hh:mm a";
var lastCol = sheet.getLastColumn();
var lastRow = sheet.getLastRow();
var lastCell = sheet.getRange(lastRow, lastCol);
var timeStampCell = sheet.getRange(lastRow, lastCol + 1);
if(timeStampCell === " ") {
var date = Utilities.formatDate(new Date(), timezone, timeFormat);
timeStampCell.setValue(date);
};
}