Reputation: 119
I'm looking to display the current user of a google sheet in a cell to pull a vlookup off,
I have added a script to pull the logged in username into a script gallery but I am unable to dump the logger.log information into a google sheet
Upvotes: 10
Views: 27860
Reputation: 321
This works fine :) remember how to use getRange(row,column) as it will be your best friend now you are scripting..
function setActiveUser() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
// GET EMAIL ADDRESS OF ACTIVE USER
var email = Session.getActiveUser().getEmail();
Logger.log(email);
//SET CELL A1 TO EMAIL ADDRESS OF ACTIVE USER
sheet.getRange(1,1).setValue(email);
}
Upvotes: 17