Google Sheets – Use External Add-on Function in Custom Function

google sheetsgoogle-apps-script

I installed an Add-on for Google Sheets which has a function myAddOnFunction that I can call in any cell and it works great and shows the value I expect.

I am writing my own custom function in the script editor and want to call myAddOnFunction() there for some calculations, but when I try to call it I get a ReferenceError.

How can I access myAddOnFunction() inside script editor?

Best Answer

In short, you cannot access myAddOnFunction() programmatically.

However, what you could try is simply inserting the necessary text into your target cell. For example:

var cell = yourRange.getCell(1, 17);
cell.setValue('=myAddOnFunction(yourParameters)');

If the add-on is designed to execute functions when present in cells, inputting that string into a cell would trigger the add-on.