How can I add an addon to the google docs side pannel?

Viewed 171

Is there any way for developers to add icons to the side panel? The documentation I've seen only shows custom side-bars and the addon ui menu, but the built-in side panel is fairly new and has a button to add add-ons, suggesting that addons would be added to it.

enter image description here

I'd like to add an icon to the built-in side panel to avoid extra clicks for my add-on.

UI Reference Custom Sidebar

1 Answers

You need to include sheets in the addOns section of the manifest, as specified here. The documentation for add-ons is available at https://developers.google.com/gsuite/add-ons/overview

Here's a simplified example derived from Quickstart: Cats Google Workspace Add-on

Code.gs

function onHomepage(e) {
  return CardService.newCardBuilder().addSection(
    CardService.newCardSection().setHeader('Header').addWidget(
      CardService.newTextParagraph().setText('Paragraph')
    )
  ).build();
}

appsscript.json (manifest)

{
  "timeZone": "Etc/GMT",
  "dependencies": {},
  "exceptionLogging": "STACKDRIVER",
  "runtimeVersion": "V8",
  "addOns": {
    "common": {
      "name": "Cats",
      "logoUrl": "https://www.gstatic.com/images/icons/material/system/1x/pets_black_48dp.png",
      "homepageTrigger": {
        "runFunction": "onHomepage",
        "enabled": true
      }
    },
    "sheets": {}
  }
}

The homepageTrigger doesn't need to be in the common section. You could include place it directly within sheets instead.

Related