Is there a way to insert an automatic "last edited" timestamp in the footer of a Google Document?

I would like to make sure that time stamp is on the document when I print. I figure out how to enter a "today" time stamp but need a script to pull "last edited" and, if possible, the user that last edited.

  • Seems impossible... although a script could be used to update a footer, there is no trigger "when edited" for Google Documents. – user79865 May 12 '16 at 0:41
  • Let us continue this discussion in chat. – Rubén Apr 19 '18 at 3:01

Yes, there is. Use file.lastModifyingUserName and file.modifiedDate.


function lastEdited() {
  var doc = DocumentApp.getActiveDocument();
  var id = doc.getId();
  var file = Drive.Files.get(id);
  var footerSection = (doc.getFooter())?doc.getFooter():doc.addFooter();
  var userName = file.lastModifyingUserName;
  var date = file.modifiedDate;
  var text = '[Last edited by ' + userName + ' on ' + Utilities.formatDate(new Date(date), 'GMT+5', 'YYYY/MM/dd hh:mm') + ']';
  var p = footerSection.insertParagraph(0,text);


  1. To use the above script you should enable the Google Drive Advanced service as is described in - https://developers.google.com/apps-script/guides/services/advanced


| improve this answer | |
  • Where does this script go? – JackKalish Feb 11 at 20:35
  • 1
    @JackKalish I added a reference to my answer. – Rubén Feb 11 at 20:44
  • @Rubén - I still only see an available event type of "On Open" which would update the document only when someone opens it the next time, right? Or am I missing something? – idean Mar 3 at 18:30
  • @idean This Q/A isn't about triggers in Google Docs. Please post a new question. – Rubén Mar 3 at 20:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.