I'm not sure the proper terms for what I'm trying to do, but essentially, consider if I have the following headers in my document:
1. Section
a. Sub-Section
b. Sub-Section
c. Sub-Section
1. Sub-sub-section
2. Section
a. Sub-Section
3. Section
a. Sub-Section
Now, what one could refer to a section by combining all of the section numbers/letters, so "1.c.1" would point to a single section.
Is there a feature in Google Docs, or an easy to use macro/add-on which would allow me to create a link to section "1.c.1" which would automatically update if that sections number was changed?
When I say change, I mean something like if I added a section between 1 and 2, that new one would be 2, 2 would be 3, 3 would be 4.
I could easily create a normal page link, but I'd really prefer not to have to seek out every single reference to every single section have to manually update those references. If it included the header text of the section along with the complete number, that would be a plus (like "1.c.1 Sub-Sub-Section").
Best Answer
I couldn't find an already built solution, so I decided to build my own.
Turns out, the API doesn't actually let you get direct header URLs (https://issuetracker.google.com/issues/36761940). Funny enough, the ability was requested 4 years ago and just today was sent to the Google team to investigate.
It turns out there is a workaround to this as long as the document has a Table of Contents that is up-to-date. That was a workaround I could (begrudgingly) accept. Here is the code I wrote.
When run, it will find all links which reference a heading (starts with
#heading
) and will update the text of the link to match the text found in the Table of Contents (which if up-to-date, matches the heading text itself).