open google doc by id
google-apps-script, google-docs-api, url
Solution
The document id is not the URL of the document, but it is a UID generated when the document is created, e.g., it is the value of id after `var id = createDocWithTable("doc with table")`.
You need to keep track of this id separately. If you have the document object, you can retrieve it with its `getId()` method. The ID is also encoded into the URL, so `https://docs.google.com/document/d/3ckYOu8kuIfBzbu-Dtu9XwGHUnUJG32PK7wHe5xMv3VG/` has document id `3ckYOu8kuIfBzbu-Dtu9XwGHUnUJG32PK7wHe5xMv3VG`
Problem
What I am trying to do is make a copy of a template doc, the append sheet data to the new file. I am using the doc URL as the id. However, when I try to access the file I am getting this error "Document is missing (perhaps it was deleted?) (line 21)" Line 21 is ``` var templateid = "URL"; var file = DocumentApp.openById(templateid); ``` Can anyone advise on what the problem could be?