detect bookmark in Doc?

30 views
Skip to first unread message

Ed Bacher

unread,
Oct 29, 2024, 5:37:35 PM10/29/24
to Google Apps Script Community
Is it possible to detect existing bookmarks in a Doc? I know that it's possible to insert a bookmark, but I don't see any obvious way to detect one (not in the Attribute enum).

Am I missing something? (I hope so.)

Thanks,
Ed

Edward Friedman (Eddie)

unread,
Oct 30, 2024, 2:33:53 AM10/30/24
to Google Apps Script Community
The Document object has a getBookmarks method that allows you to get all of the bookmarks in a document at once. Then you have to loop through them to find the one that you want. Here is the link to the documentaton: https://developers.google.com/apps-script/reference/document/document#getbookmarks

There is also a getBookmarks method for the DocumentTab object. Here is the link to the documentaiton: https://developers.google.com/apps-script/reference/document/document-tab#getbookmarks

Ed Bacher

unread,
Oct 30, 2024, 6:17:44 AM10/30/24
to Google Apps Script Community
Thanks, Eddie -- I was indeed missing something!
Reply all
Reply to author
Forward
0 new messages