ehannes
ehannes

Reputation: 509

Get current Drive folder id in Google Apps Script

I have a Google Workspace Add-on which I have enabled in Google Drive. I would like to get the current folder ID when in Google Drive and no files are selected nor any document is opened. I can't find any method of getting the ID from the DriveApp class. The ID is in the URL, like https://drive.google.com/drive/.../folders/FOLDER_ID, but I can't reach it since window is not defined.

Thanks!

Upvotes: 0

Views: 243

Answers (1)

Paul Armstrong
Paul Armstrong

Reputation: 11

I have been doing a lot of work around this API, and I am pretty sure you can't get what you want.

If it were possible, it would be included in the event passed via the homepageTrigger. Which it is not.

DocumentApp and other doc apps have a getActiveDocument() method. But there is no equivalent on DriveApp.

Upvotes: 1

Related Questions