Does anyone have an idea of what could be wrong? Is there a better approach to opening a document using a URL?
You can try this approach:
function myFunction() {
var url = "1bmad4K86Ov1zQHiu8gbX6GpOSL9kbNGKiE3jmaJN9N8";
var doc = DocumentApp.openById(url);
}
If you do not have access to it it will show the following error:
Exception: Action not allowed
Reference: openById()