I have a sheet in my Google spreadsheet that contains 5 cells, the first 3 contain only words, and the last 2 contain time, in particular, a timestamp.
cell 1 = data cell 2 = data cell 3 = data cell 4 = time start cell 5 = time ended
Now I want that when cell 1 was supplied with data, the time stamp would automatically appear in cell 4. And when cell 2 and cell 3 were supplied with data, the time stamp would be the new value for cell 5.
My friend, give me the code to be inserted into the script editor:
function readRows() { var sheet = SpreadsheetApp.getActiveSheet(); var rows = sheet.getDataRange(); var numRows = rows.getNumRows(); var values = rows.getValues(); for (var i = 0; i <= numRows - 1; i++) { var row = values[i]; Logger.log(row); } };
And
function onOpen() { var spreadsheet = SpreadsheetApp.getActiveSpreadsheet(); var entries = [{ name : "Read Data", functionName : "readRows" }]; spreadsheet.addMenu("Script Center Menu", entries); }; function timestamp() { return new Date() }
and this code is inserted in =IF(B6="","",timestamp(B6))
cell 4, and this code =IF(D6="","",timestamp(C6&B6))
is in cell 5. in it An example tracker works. But when I copied it to mine, the output in cell 4 and cell 5 is the date today, not the time.
Can someone help me? why displays date and not time?