2
votes

Is it possible to call a Google Sheets add-on as if it were a function in an Apps Script?

I am trying to automate a few steps like this:

  1. Import/append data from sheet 1 to main sheet 1
  2. Import/append data from sheet 2 to main sheet 2
  3. Merge values/append new values from main sheets 1 and 2 into main sheet 3

All of these steps are done with 2 add-ons. Ideally, I could call those add-on functions with a script and run the script with a button.

Is this possible?

2
I just tried to call a function to my Add-on from a script in a Document that has the Add-on installed, and it didn't work.Alan Wells
From the discription I would imagine you can use the importrange() function for items 1 and 2 and then possibly lookup or the query() functions to do item 3 provided there is a common column between the data from item 1 and 2. If the data actually aligns by row, you wouldn't need the lookup. There is a good possibility, depending on the data, that this could all be done with 3 built in formulas. Access to a sample file would help deter,mine if this is the case.Karl_S

2 Answers

0
votes

Short answer

AFAIK it's not possible.

Explanation

Google Apps Script official documentation doesn't include this on the Guides section, by the other hand, there aren't a documented way to call add-on functions other than the custom menus and the add-on dialogs, sidebars, custom functions and triggers.

0
votes

This is possible however all users have to have view permission to the underlining script file that you publish from.

I'm not sure this is bullet proof but to help limit the exposure of the code I've:

1) Share code with option "Anyone at My Domain with the link"

  • only my domain users can access it (not everyone on the web)
  • make it a little harder to find (so they can't search for it)

2) Break off any function you don't want users to potentially see into a seperate Library; make this Library private