I'm discovering Google App Script and I'm very attracted by its potential.
I want to improve a Google Document by adding a custom menu. I found many how-to to make this in a spreadsheet but nothing for document.
Did I miss anything ?
I'm discovering Google App Script and I'm very attracted by its potential.
I want to improve a Google Document by adding a custom menu. I found many how-to to make this in a spreadsheet but nothing for document.
Did I miss anything ?
From: https://developers.google.com/apps-script/reference/document/document-app#getActiveDocument()
// Add a custom menu to the active document, including a separator and a sub-menu.
function onOpen() {
DocumentApp.getUi()
.createMenu('My Menu')
.addItem('My Menu Item', 'myFunction')
.addSeparator()
.addSubMenu(DocumentApp.getUi().createMenu('My Submenu')
.addItem('One Submenu Item', 'mySecondFunction')
.addItem('Another Submenu Item', 'myThirdFunction'))
.addToUi();
}
It is not possible to have a Document as a container for a script and therefore not possible to add a menu item to the Document.
There is an open issue on the issue tracker which you can subscribe to.