Today I will show you how to make a SideBar addon with Google Apps Script.
This tutorial is very simple.
Open one sheet into your google drive account.
Go to Tools – Script editor … and that will open a new tab into your browser with the script editor.
Save your sheet and your project from the script editor.
You need to add this source code into your Code.gs file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | function onOpen() { SpreadsheetApp .getUi() .createAddonMenu() .addItem('SideBar Item', 'openSideBar') .addToUi() } function onInstall(){ onOpen(); } function openSideBar() { var html = HtmlService.createHtmlOutputFromFile('openSideBar').setTitle('SideBar html'); SpreadsheetApp.getUi().showSidebar(html); } |
The next step is to add an HTML file named: openSideBar.html.
Go to File – New – Html file and add a new HTML file with this source code:
1 2 3 4 5 6 7 8 9 | <!DOCTYPE html> <html> <head> <base target="_top"> </head> <body> This is html open by openSideBar </body> </html> |
You now run the Google Apps Script.
Google wants to have your permission to run this into Google applications area :
Display and run third-party web content in prompts and sidebars inside Google applications
This allows you to run the addon and result will be a sidebar HTML file, see: