How to Solve “The document is inaccessible. Please try again later.” Error

Overview

I will share the solution when I encounter the following error when running GAS(GoogleAppsScript).

Exception: The document is inaccessible. Please try again later.
methodName1 @ ScriptName.gs:38
methodName2 @ ScriptName.gs:20

Solution

I was trying to create a copy of a google document with the following code.

The problem was that the google document I was trying to load was actually “Word format" not “Google Document format".

var documentId = "enter your google document file name"  
var file = DriveApp.getFileById(documentId).makeCopy('NDA_' + lastname);
var nda = DocumentApp.openById(file.getId());

Other solution?

In the StackOverflow below, the solution of changing the default account of the Chrome browser was answered, but it was not effective in my case.

https://stackoverflow.com/questions/48029224/google-scripts-document-inaccessible

Other

Posted by regardie