Created
October 31, 2017 16:27
-
-
Save aflansburg/a0620fe9b79a97b05c9c9d74bc536ae5 to your computer and use it in GitHub Desktop.
Timestamp and user stamp last update on a google sheet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function timestampIt(){ | |
var ss = SpreadsheetApp.getActiveSpreadsheet(); | |
var sheet = ss.getSheets()[0]; // this will assign the first sheet | |
var cell = sheet.getRange('A1'); | |
var d = new Date(); | |
d.setHours(d.getHours() +1); | |
var user = Session.getActiveUser().getUserLoginId(); | |
user = String(user); | |
user = user.replace('@gmail.com', ''); | |
cell.setValue('Last updated: ' + d.toLocaleString() + ' by ' + user); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks , But the user ID will not print in cell , I must run the script in script editor to print user ID in sheet . strange