简体   繁体   中英

Is "Test as add-on" for Google sheets editor add-ons broken?

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.

查看我的测试设置的屏幕截图,它确实显示已启用是。

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);

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM