15

Once you add a header to a Google document, it offsets the top of the document even if empty, and receives click events. How can you then remove the header?

I am aware that you can reduce the header's effects by decreasing the page's top margin, and reducing the font size in the header—those are not the solutions I am looking for. I would like a way to actually REMOVE it.

  • To be clear: I'm also not looking for "Control+z/Edit->Undo" or the like. – trex005 Jan 29 '15 at 15:36
  • I fear you are correct. – trex005 Jan 29 '15 at 15:46
19

edit

There's an Add-on available that removes the header or footer in the active document only once added:

Documents by Top Contributors

enter image description here

Goto your Google Document and choose from the menu Add-ons > Get add-ons... and search for:

enter image description here

Affiliation: I wrote the add-on


The following line of code will reset the header (gray line disappears).

Code

function onOpen() {
  DocumentApp.getUi().createMenu("Header / Footer")
    .addItem("Reset header", "resetHeader")
    .addItem("Reset footer", "resetFooter")
    .addToUi()
}

function resetHeader() {
  try {
    DocumentApp.getActiveDocument().getHeader().removeFromParent();
  } catch(e) {
    throw "No header present !!";
  }
}

function resetFooter() {
  try {
    DocumentApp.getActiveDocument().getFooter().removeFromParent();
  } catch(e) {
    throw "No footer present !!";
  }
}

Screenshot

before
enter image description here

after
enter image description here

Note

I've noticed that after running the script (and thus removing the header or footer), adding them wasn't possible on the document I was working on.

Add the code under Tools > Script editor..., press the bug button to authenticate the script and then press the play button. This will "play" the code and reset the header.

edit
See Google Help Forum for an extensive walk-through: How to remove the header in Google Docs?

  • 1
    Was a little awkward of a solution, but it worked like a charm. I blame the awkwardness on Google. – trex005 Jan 29 '15 at 19:48
  • Doesn't work: TypeError: Cannot call method "removeFromParent" of null. (line 2, file "Code"). – Fish Monitor Sep 27 '15 at 13:09
  • @fossilet: It needs to have a header in the first place. Did you have a header? – Jacob Jan Tuinstra Sep 27 '15 at 13:17
  • @JacobJanTuinstra, I had a footer instead. Maybe I should change the function names? – Fish Monitor Sep 28 '15 at 13:11
  • 1
    This worked for me, and really saved the day. Thanks! – JHS May 3 '16 at 2:39
0

All you need to do is copy all your text and then get a new doc. Paste it onto there and you're done

  • 4
    This doesn't really answer the question. – jonsca Apr 12 '17 at 1:29
  • 1
    @jonsca It does actually, because there's no way to remove it (other than some script, which I won't count). Scripts are utterly stupid way to achieve this for the same reason as why you won't write a script to remove the bold from a line of text. No idea what they were thinking implementing the headers but not implementing removing them (WTF stuff right there). – Achshar Oct 22 '17 at 22:05

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.