How to connect a Google Doc first time, about five minutes
In your Google Doc: Extensions → Apps Script.
Delete the stub, paste the whole script in
In the script, set SHARED_SECRET to a password you make up. (Run → gen makes one; copy it from the Execution log.)
Save. Then Run → test_localFetch and approve the consent screen — that is what gives the script access to your Doc. The log shows the title and a chapter count.
Deploy → New deployment → Web app: Execute as Me, access Anyone with the link. Copy the URL that ends in /exec.
Paste that URL and the same password below, then Fetch.
After editing the script later: Deploy → Manage deployments → pencil → New version. Saving alone changes nothing the URL serves.