google apps script - HeaderSection copy to new document -
in google apps scripts, i'm trying copy headersection new document in it's entirety (so can replace name text name) so used: var thedoc = documentapp.openbyid('idnumber'); var theprotoheader = thedoc.getheader().copy(); thedoc.saveandclose(); thedoc = documentapp.openbyid(thedocid); if (! thedoc.getheader()) { thedoc.addheader(); } var thenewheader = thedoc.getheader().clear(); thenewheader = theprotoheader; but no success last line ... ideas? wiki