Reputation: 349
I am trying to get the ID of the doc that I am working on. Currently I am using
var files = DriveApp.getFileById('whatever the doc Id is')
and this works fine. However, I want to be able to get any document Id that this application may be running on. I don't want the user to go into the code and switch the ID depending on what document they are on. If anyone has any ideas I would love to hear them,
Thanks
Upvotes: 8
Views: 32559
Reputation: 71
The id for a file/folder is also in its url. Opening a file you want the id for, your url bar says: https://docs.google.com/document/d/exampleid1234qwer5678tyui/edit
The id for that doc will be: exampleid1234qwer5678tyui
Upvotes: 7
Reputation: 349
Geez I should really have more faith in my guess and check abilities.
var files = DriveApp.getFileById(DocumentApp.getActiveDocument().getId());
files.setDescription(des);
This works
Upvotes: 15