So here it goes...my supervisor had me create a spread sheet that allows us 
to automatically calculate the times of different segments of our show. 
When someone updates the spreadsheet with a new time he wants something to 
show in the document who last updated it and when (date and time). 

There is a way to see who revised it by clicking "revision history," but he 
wants something that shows up in the actual spreadsheet; without having to 
click any extra buttons. I found two scripts that work (listed below) but 
for some strange reason when I (the creator of the spreadsheet) make edits 
it shows my email, the date and time of the update. But when someone else 
makes an edit it only shows the date and time. EVEN if the updater has a 
Gmail address, is using  Chrome and the spreadsheet is shared with them 
under 'can edit.' 

I used the following scripts: 

function onEdit(event)
{
  var r = event.source.getActiveRange();
  var comment = r.getComment().replace("Last modified by: ","previously 
modified by");
  r.setComment("Last modified by: " 
+Session.getEffectiveUser().getEmail()+" on: "+(new Date())+comment);
}

AND

function onEdit(e)

{ 
  // Get all information, Cell, Date, User

  var sheet = event.source.getActiveSheet();

  var cell = event.source.getActiveRange();

  var date = Utilities.formatDate(new Date(), "GMT", "dd-MM-yyyy");

  var user = Session.getActiveUser().getUserLoginId();

  //Write to Cell Comment

  cell.setComment(date + " User:" + user);
  var user = Session.getActiveUser().getEmail();
sheet.getRange(index, (dateCol + 1)).setValue(user);

}

-- 
You received this message because you are subscribed to the Google Groups 
"Google Spreadsheets API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to