Reputation: 13
I'm trying to figure out how to get the ID of currently opened document on Google Apps. Even though I researched on Google, I couldn't find anything useful.
The function that I expect to use is DocsList.getFileById()
, but it seems no way to get the opened document ID.
Any suggestions?
Upvotes: 0
Views: 1131
Reputation: 45710
Use DocumentApp.getActiveDocument()
.
// Get the id of the document to which this script is bound.
var docId = DocumentApp.getActiveDocument().getId();
Upvotes: 2