I need to be able to more efficiently change a link to the heading text the link points to, without having to do cumbersome steps.

This a workaround for the more ideal feature that, as of 2020-05-22, has yet to be implemented by Google: How to insert links to headings in Google Docs without brute force (incremental completion and narrowing)

See the image below which explains the problem. Below that image, see the steps to reproduce this problem:

enter image description here


  1. Open an existing Google Doc, or create new one.
  2. Add a heading.
  3. Click on the link of that heading inside the Outline view to the left.
  4. Move the mouse into the browsers address bar, select the URL, and type CTRL+c to copy it into the clipboard.
  5. Move the mouse into the document, and type CTRL+v to paste the URL.
  6. Left mouse click into the URL just pasted.
  7. See the popup (see image below).
  8. Notice that it has the text of the whole document, which is not what I want. Instead, I want that to be the heading text of that section.

I do not want to workaround this by having to edit the URL text, or have to use method of adding links to headings using CTRL+k, as that is taking up too much time when this operation is done many, many times during an editing session: It is cumbersome because it forces you to scroll down a list of all headings in the document, versus driving to it directly, and that list of headings can be quite large. As the number of headings increases, it becomes impractical to scroll down that list every single time to find the heading.

1 Answer 1


If you use Google Sheets, there is a way to do this. ImportXML() is the function needed.

=Hyperlink($I2, IMPORTXML($I2,"//title"))

$I2 is the URL itself.

I'm afraid I don't know if this works in Google Docs or not.

Note that I found this answer "hidden" in a Zapier forum.

  • 2
    This question is specifically for Google Docs, not Google spreadsheets. I have found in the past that there is not a whole lot that works in both applications.
    – bgoodr
    Apr 26, 2022 at 14:11
  • Of course, but they are both easily available tools. I sometimes process data in Sheets, then move to Docs for distribution to my colleagues. "The right tool for the right job."
    – MXMLLN
    Apr 27, 2022 at 15:04
  • 1
    I know this isn't an answer to this question, but it perfectly solves my problem, thank you!
    – flashton
    Jun 17, 2022 at 10:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.