1

I wrote a Google Sheet editor add-on 1 year ago that I have been using ever since for my personal use. I didn't end up publishing it.

I have always used it with the same spreadsheet, launching with the legacy editor's "Run -> Test as add-on" giving it the Installed and Enabled authorization (I have a saved config for this). It worked like a charm, there is even some checking in the onOpen for whether it is Enabled for the doc.

Today it stopped working without me making any changes. Simply the add-on doesn't seem to load. The spreadsheet opens but the add-on is not invoked. I see no new executions in the logs and the add-on is neither loaded in the menu nor is the popup rendered which should if it is not Enabled. It seems like the Test as Add-on feature is broken. Tried it also with another spreadsheet that's compatible with the add-on with the same result. I even tried to create a net new test config with Installed and Enabled and got the same result.

Anyone experienced the same issue with Google Sheet editor add-ons run with "Test as add-on"? Any known workarounds or solutions to make it load again?

This the screen shot of my test settings showing that the add-on is configured to be Enabled for the document.

See a screenshot of my test settings, it does say Enabled Yes.

Here is my code snippet from onOpen that should catch if the add-on is not enabled:

     //Testing if the add-on is enabled against a compatible doc. Otherwise show welcome message with instructions. 
  var ret = null;
  try{
    ret = SpreadsheetApp.getActive().getRangeByName("TOTAL_RETAINED_VALUE");//Check if critical named range is defined.
  } catch (e){}//If the add-on is not enabled on the doc this call will throw an unauthorized excepton. 
  if (ret == null) 
    ui.alert("Welcome to the XXx add-on", "This add-on helps you XXX... more instructions on how to fix this issue", ui.ButtonSet.OK);
  • You can search for current related issues on Google's Issue Tracker. Here is a link for an example search: [https://issuetracker.google.com/issues?q=status:open%20test%20addon](https://issuetracker.google.com/issues?q=status:open%20test%20addon) If you are only using the code in one Sheets file, then you don't need to publish an addon. You could use an Apps Script project file that is bound to the Sheet. – Alan Wells Jun 06 '21 at 14:19
  • Are you seeing this happen with any other add-on project or just this one? – Rafa Guillermo Jun 07 '21 at 07:16
  • @RafaGuillermo Thank you for asking. I only have this one add-on so cannot really tell unfortunately. – Viktor Müller Jun 07 '21 at 17:20
  • I haven't been able to reproduce this, I've had no issues with testing add-ons at all. Are you still experiencing this? If so, if you have a Google Workspace account it might be worth opening a support ticket with them [link](https://support.google.com/a/answer/1047213?hl=en). – Rafa Guillermo Jun 08 '21 at 10:59

2 Answers2

0

The test as add-on button in Chrome (as tested on Version 93.0.4577.63 Official Build x86_64 in MacBook Pro) is not directing to the correct url that allows you to view the tested add-on. If you test it in the latest Firefox it works.

Explanation: When you click on test as add-on, a preview document is supposed to be generated as per the official documentation. The add-on preview document has a specific URL. This url can also be shared with editors of the original test document (which allows for testing).

The format of the url is similar to https://docs.google.com/document/d/***id***/edit?addon_dry_run=***id**** When I tested the add on in Chrome the url is https://docs.google.com/document/d/**id**/edit without the additional addon_dry_run bit. However on testing it in Firefox, it worked perfectly. So a temporary fix would be to try a different browser, I recommend Firefox, to see if this addresses the issue.

Tanya Gupta
  • 560
  • 4
  • 15
0

It appears that the only Trigger Code allow to be tested is onInstall()

All other triggers are disable when "testing as addon..."

See Testing Google Sheet Addon Triggers for more details

Nathan
  • 412
  • 6
  • 16