Created
February 21, 2018 21:25
-
-
Save vibol/70b7545db3d4c76b55da0dbea266e1aa to your computer and use it in GitHub Desktop.
Google Docs: A Google App script for deleting all bookmarks from a Google Doc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. Tools > Script editor... | |
// 2. Paste the below code | |
// 3. Run | |
// 4. Approve permissions | |
// 5. Go to the document from which Script editor was launched and allow the script to run | |
function deleteAllBookmarks() { | |
var ui = DocumentApp.getUi(); | |
var response = ui.alert('This will delete ALL bookmarks in this document. Are you sure you want to continue?', ui.ButtonSet.YES_NO); | |
if (response == ui.Button.YES) { | |
var doc = DocumentApp.getActiveDocument(); | |
var bookmarks = doc.getBookmarks(); | |
for (var i = 0; i < bookmarks.length - 1; i++) { | |
bookmarks[i].remove(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script also works in the console; however, you may need to scroll through multiple pages to ensure they're all removed.