23

Anybody else having trouble with the setWidth function? The example here is "300", but if you change the number, the sidebar is the same width. I've tried a few times on a clean spreadsheet.

https://developers.google.com/apps-script/guides/dialogs#custom_sidebars

Rubén
  • 34,714
  • 9
  • 70
  • 166
jason
  • 3,811
  • 18
  • 92
  • 147

2 Answers2

29

Google Scripts now ignore the setWidth() method and the sidebar width is now fixed at 300px. From the release notes:

In Google Docs and Forms, sidebars now ignore the setWidth() method; they cannot be changed from the default width of 300px. This change was applied to the new version of Sheets in the previous week's release.

Amit Agarwal
  • 10,910
  • 1
  • 32
  • 43
25

I created a little workaround for this (although this is only useful if this sheet is something you're using for yourself or internally in a company, but not for deployment to other users)...

I created a bookmark containing the following JS, and run it form my favourites bar whenever I want to widen the sidebar (also, any sidebar opened thereafter in that session will open at the new width):

javascript:void(window.top.document.getElementsByClassName("script-application-sidebar")[0].style.width='500px')

To create the bookmark (this example is for Chrome), right click on your favourites bar, click 'Add Page', and paste the above JS into the URL field. Name it whatever you want, e.g. 'Widen Sidebar'. Just click that whenever the sidebar is visible in your Google Sheet.

Stu Marlow
  • 532
  • 5
  • 8