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
}