Update footer date, don't clear the contents

by KCSunshines   Last Updated January 11, 2018 18:03 PM

This lovely bit of code for a Google Doc template I use, does exactly what I need it to do except it clears all of the content in my footer instead of just the date. Is there any way to get just the former date cleared and not the rest of my copy? I'm looking to automate my copyright data when a document is opened:

function onOpen() {
  var doc = DocumentApp.getActiveDocument();
  var footer = doc.getFooter();  //gets the footer
  footer.clear();  //clears all data in footer

  //Get date
  var date = new Date();
  var year = date.getFullYear();

  footer.appendParagraph(FullYear);  //adds date to footer
 }


Answers 1


Yesenter image description here hi friends please help me and support my application

Raju Kumar
Raju Kumar
January 11, 2018 17:56 PM

Related Questions


Google Docs date capitalisation script

Updated December 23, 2017 17:03 PM


Alternative to "UrlFetchApp.fetch" at Google Docs?

Updated November 16, 2017 00:03 AM


Google Script - convert link to image in doc

Updated March 13, 2018 03:03 AM