this is the code i wrote:
function importEventData(){
var dFile = DocsList.getFileById("0Ar2YhVnsK7LLdGVrUFdpRUVQTHJ0aG1SVkp6V0JMMkE");
var text = DocumentApp.openById("0Ar2YhVnsK7LLdGVrUFdpRUVQTHJ0aG1SVkp6V0JMMkE").editAsText().getText();
return text;
};
The first line of the function works. But unfortunatly at the second line the google compiler stops and say: "Document is missing.(maybe it is deleted.)" Now I'm trying about several hours, search accross the web, but can't find the problem. The script has permissions to access my gDrive. Although I tried to get the id from the dFile.getId() function. But this produces the same string and the same error.
var text = DocumentApp.openById("0Ar2YhVnsK7LLdGVrUFdpRUVQTHJ0aG1SVkp6V0JMMkE").getBody().editAsText().getText();
You need to add .getBody()
before .editAsText()
because DocumentApp.openByID('id')
returns a document class object and the editastext method only applies to the body object. This is seen here in Google's documentation: https://developers.google.com/apps-script/reference/document/document-app
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With