pcoughlin
8/27/2015 - 5:17 PM

Google Apps Script-let for timestamping a Google Document footer

Google Apps Script-let for timestamping a Google Document footer

// modified from http://binarywaste.blogspot.co.uk/2013/06/google-docs-inserting-date-in-footer.html
function timeStampFooter() {
  var doc = DocumentApp.getActiveDocument();
  var footer = (doc.getFooter()) ? doc.getFooter() : doc.addFooter();
  footer.setText("");
  var divider = footer.appendHorizontalRule();
  var footerText = footer.appendParagraph('Confidential and Proprietary + Accessed ' + new Date());
  footerText.setFontSize(9);
  footerText.setForegroundColor('#4a86e8');
  footerText.setAlignment(DocumentApp.HorizontalAlignment.RIGHT);
  return doc;
}