Ryan Swindells
Ryan Swindells

Reputation: 11

Google Sheets Macro returning an error when trying to trigger an add-on

I am trying to automate the use of a Google Sheets Add-On using a macro on a daily time-based trigger. The Add-On is the Greenhouse Report Connector, which allows you to refresh reports direct from the Greenhouse ATS.

I started by recording the macro as standard within Sheets, and then creating the time-based trigger.

When running the macro, I encounter the following error message:

ReferenceError: openRefreshAllReports is not defined
    at RefreshingGreenhouseData(macros:4:3)

This seems to reference the 4th line of code below, which is the instruction to actually press the Refresh All Sheets option within the add-on. Below is the first 8 lines of code which starts the macro and includes an example for one of the sheets being refreshed in the macro (starts at line 5)

function RefreshingGreenhouseData() {
  var spreadsheet = SpreadsheetApp.getActive();
  spreadsheet.getRange('A1:D1').activate();
  openRefreshAllReports();
  spreadsheet.getSheetByName('Sheet x').showSheet()
  .activate();
  spreadsheet.setActiveSheet(spreadsheet.getSheetByName('Sheet x'), true);
  spreadsheet.getRange('A1:E1').activate();

Does anyone have any suggestions as to how we can get this to work? Is this a common issue when trying to incorporate add-ons into macros?

Thanks in advance

Upvotes: 1

Views: 487

Answers (1)

See this question to help you understand more about this long and common issue.

So, short answer: No, it is not possible to fix this issue.

I have seen this many times over the last two years working with Google Script, its capabilities and limitations are huge. In the end, sadly, we have to give more time to do what you want to accomplish or by finding a manual code approach to what you want to accomplish, in such case, we can kindly help you.

Regards.

Upvotes: 1

Related Questions