detect bookmark in Doc?

25 views
Skip to first unread message

Ed Bacher

unread,
Oct 29, 2024, 5:37:35 PMOct 29
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 AMOct 30
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 AMOct 30
to Google Apps Script Community
Thanks, Eddie -- I was indeed missing something!
Reply all
Reply to author
Forward
0 new messages