I am completely unfamiliar with JavaScript but I am trying to create a script that makes a formatted timestamp in a specific cell when a button is pressed.
I have gotten it to work with a true/false in sheets however I don't know how to make this in JavaScript. This is as far as I have gotten so far and I'm already hitting errors I do not understand.
Can someone help me understand or link me resources on how to figure out some of these problems? I've spent several hours googling and reading Google developer pages trying to learn but I haven't had any luck thus far.
The error:
function myFunction() {
var sheet = SpreadsheetApp.getActiveSheet()
var date = new Date(); var timeStamp = date.getTime(); // Unix Timestamp
var currentTime = date.toLocaleTimeString(); // eg. 10:23:30 AM HKT
sheet.setValue(currentTime);
}
