2

This accepted answer says that it's not possible to get custom Google Sheets functions into Google Sheets from a Google Workspace Add-on.

However, I came across a counterexample that proves the above conclusion incorrect.

The link to the workspace add-on is here.

One can install the add-on as expected like this.

enter image description here

But immediately upon installing the Workspace Add-on, one can access the dropdown menu under the extensions tab (usually reserved for Editor Add-ons only) without taking any additional steps. The dropdown menu is immediately available. All one needs to do is click the button once to install the custom functions.

enter image description here

So, somehow, installing the Workspace Add-on automatically installs the Editor Add-on.

How is this accomplished?

I assume the following code is also applicable in this case too.

Code.js
const ss = SpreadsheetApp.getActiveSpreadsheet();

function onOpen( e ) {
  ui.createAddonMenu()
    .addItem( 'Start', 'showSidebar', )
    .addToUi();
  
  const menuItems = [];
  menuItems.push({ name: 'Start' , functionName: 'showSidebar' });
  ss.addMenu( 'MyApp', menuItems, );
}

function showSidebar() {
  // code TBD
  // right now, I'm just trying to get the menu to appear
}
Sidebar.html
<html>
  <body>
    <div>Hello World</div>
  </body>
</html>
appsscript.json

{
  "timeZone":"America/Los_Angeles",
  "dependencies":{
    
  },
  "exceptionLogging":"STACKDRIVER",
  "runtimeVersion":"V8",
  "addOns":{
    "calendar":{
      "createSettingsUrlFunction":"getConferenceSettingsPageUrl",
      "conferenceSolution":[
        {
          "id":"my-video-conf",
          "logoUrl":"https://lh3.googleusercontent.com/...",
          "name":"My Video Conference",
          "onCreateFunction":"onCreateMyVideoConference"
        },
        {
          "id":"my-streamed-conf",
          "logoUrl":"https://lh3.googleusercontent.com/...",
          "name":"My Streamed Conference",
          "onCreateFunction":"onCreateMyStreamedConference"
        }
      ],
      "currentEventAccess":"READ_WRITE",
      "eventOpenTrigger":{
        "runFunction":"onCalendarEventOpen"
      },
      "eventUpdateTrigger":{
        "runFunction":"onCalendarEventUpdate"
      },
      "eventAttachmentTrigger":{
        "label":"My Event Attachment",
        "runFunction":"onCalendarEventAddAttachment"
      },
      "homepageTrigger":{
        "runFunction":"onCalendarHomePageOpen",
        "enabled":true
      }
    },
    "common":{
      "homepageTrigger":{
        "runFunction":"onDefaultHomePageOpen",
        "enabled":true
      },
      "layoutProperties":{
        "primaryColor":"#ff392b",
        "secondaryColor":"#d68617"
      },
      "logoUrl":"https://ssl.gstatic.com/docs/script/images/logo/script-64.png",
      "name":"Demo Google Workspace Add-on",
      "openLinkUrlPrefixes":[
        "https://mail.google.com/",
        "https://script.google.com/a/google.com/d/",
        "https://drive.google.com/a/google.com/file/d/",
        "https://en.wikipedia.org/wiki/",
        "https://www.example.com/"
      ],
      "universalActions":[
        {
          "label":"Open settings",
          "runFunction":"getSettingsCard"
        },
        {
          "label":"Open Help URL",
          "openLink":"https://www.example.com/help"
        }
      ],
      "useLocaleFromApp":true
    },
    "drive":{
      "homepageTrigger":{
        "runFunction":"onDriveHomePageOpen",
        "enabled":true
      },
      "onItemsSelectedTrigger":{
        "runFunction":"onDriveItemsSelected"
      }
    },
    "gmail":{
      "composeTrigger":{
        "selectActions":[
          {
            "text":"Add images to email",
            "runFunction":"getInsertImageComposeCards"
          }
        ],
        "draftAccess":"METADATA"
      },
      "contextualTriggers":[
        {
          "unconditional":{
            
          },
          "onTriggerFunction":"onGmailMessageOpen"
        }
      ]
    },
    "docs":{
      "homepageTrigger":{
        "runFunction":"onEditorsHomepage"
      },
      "onFileScopeGrantedTrigger":{
        "runFunction":"onFileScopeGrantedEditors"
      }
    },
    "sheets":{
      "homepageTrigger":{
        "runFunction":"onOpen"
      },
      "onFileScopeGrantedTrigger":{
        "runFunction":"onFileScopeGrantedEditors"
      }
    },
    "slides":{
      "homepageTrigger":{
        "runFunction":"onEditorsHomepage"
      },
      "onFileScopeGrantedTrigger":{
        "runFunction":"onFileScopeGrantedEditors"
      }
    }
  }
}

Let Me Tink About It
  • 15,156
  • 21
  • 98
  • 207
  • @https://stackoverflow.com/users/1595451/rub%c3%a9n is the absolute best SME I know on this topic. Any ideas? – Let Me Tink About It Mar 17 '23 at 20:50
  • It's very likely that they have used a single Google Cloud Project to handle mulplite add-ons. The Google Marketplace SDK allows to set a project id each add-on type. Before into going into that, be sure to understand all the stuff required. I think that all the required documentation is already linked in the previuos answers. – Rubén Mar 19 '23 at 15:39
  • @Rubén "Before going into that, be sure to understand all the stuff required." Are you aware of any "gotchas" or causes for concern? – Let Me Tink About It Mar 19 '23 at 16:33
  • In few words, just the usual... as more features are included the "thing" becomes more complex, if you don't spend time on preparation you will spend much, much time later trying to find what is causing problems. – Rubén Mar 19 '23 at 16:45
  • @Rubén Got it. But, at least conceptually, could you please explain how this information connects back to the original question? Are you saying that by using the The Google Marketplace SDK allows developers to automatically install Editor add-ons simultaneously with Workspace add-ons? I'm trying to figure out the architecture of such a solution and how that would all work together? I reviewed the docs again and still can't seem to find out what such a solution to the OP would look like or entail. – Let Me Tink About It Mar 19 '23 at 20:28

0 Answers0