0

Is there a way to write an apps script function that opens up google workspace marketplace with a specific addon page? I've seen some addons do this.

Like I want to create a button drawing on my sheet and assign an apps script function to it that opens up the marketplace on that sheet with a single click.

Screenshot

Rubén
  • 34,714
  • 9
  • 70
  • 166

2 Answers2

0

The "trick" is done by creating a spreadsheet from a template having an add-on.

When a user that have not installed yet the add-on tries to run the add-on, the Marketplace listing will be shown, otherwise the function assigned to the button will be ran.

Broad steps

Preparation

  1. Create the add-on
  2. Create the spreadsheet to be used as a template
  3. Install / activate the add-on on the spreadsheet
  4. Add the button and assign on of the the add-on functions.
  5. Submit the spreadsheet to the template gallery

Distribution

  1. Use the template to create a new spreadsheet
  2. Share the new spreadsheet to the user(s)

Use

  1. The user open the new spreadsheet
  2. The user clicks the button

Resources

Rubén
  • 34,714
  • 9
  • 70
  • 166
-1

You can't open a Dialog like the mentioned

Google Spreadsheet cannot contain a button that opens an iframe since it's outside docs.google.com

As a workaround you can open the add-on link in another tab rather than in a dialog on the same Spreadsheet page. There are several posts related despite they are not the same in your case but pretty much what you are looking for:

Jose Vasquez
  • 1,678
  • 1
  • 6
  • 14
  • It's not impossible, for example look [here](https://coefficient.io/start) they do this in the new spreadsheet they create, they have a button that runs a script which opens google workplace marketplace in a dialog – Peepooooooooooo Feb 09 '21 at 04:44
  • I think the link you provided is not related to the content you mention. When it comes to open [Dialogs or Sidebars](https://developers.google.com/apps-script/guides/dialogs) you can define a link inside of it that opens the external link, but you can't directly open the marketplace in an iframe given the screenshot you provided. – Jose Vasquez Feb 09 '21 at 08:29
  • 1
    If you go to that link and provide an email address they'll redirect you to a google sheet and in that sheet when you click the button, google marketplace opens up in a dialog... – Peepooooooooooo Feb 10 '21 at 05:26
  • 1
    As I've seen in the button example. There's nothing related in the official documentation. It's true that this is not impossible to do, for some reason that we don't know this functionality is obfuscated to the public though. Unless we don't see the code we have nothing much to do. According to the official documentation my answer is valid but this is not true at all. – Jose Vasquez Feb 12 '21 at 13:06