3
votes

Is it possible to customise the toolbar of a Google Spreadsheet/Sheets by adding a custom icon linked to a script/macro? I have only seen customised spreadsheet menus.

2
Unfortunately its not possible. - MA1

2 Answers

2
votes

Presently this isn't possible. The current set of methods on the Spreadsheet object does not include any facility to access the toolbar or add a new one.

You are limited to either adding a menu, sidebar or defining custom functions.

I myself resided to using a menu item to toggle a sidebar, much in the way described here:

function onOpen() {
  SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
      .createMenu('Custom Menu')
      .addItem('Show sidebar', 'showSidebar')
      .addToUi();
}

function showSidebar() {
  var html = HtmlService.createHtmlOutputFromFile('Page')
      .setTitle('My custom sidebar')
      .setWidth(300);
  SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
      .showSidebar(html);
}
1
votes

Its not possible with apps script but you can write a browser extension to do so. Of course users would need to install it too.