I'm creating a custom sidebar Google Docs add-on, but can't set its width. I have not published the addon as a web app.
Here's the code:
function onOpen(e) {
DocumentApp.getUi()
.createAddonMenu()
.addItem('Show sidebar', 'showSidebar')
.addToUi();
}
function showSidebar() {
var html = HtmlService.createHtmlOutput('<b>Hello!</b>')
.setSandboxMode(HtmlService.SandboxMode.IFRAME)
.setTitle('How wide is this?')
.setWidth(600); // or 200; neither works - width is always 300px
DocumentApp.getUi().showSidebar(html);
}
And here's what I get: always a 300-px wide sidebar:
Here's the test document