2
votes

I'm developing my first Google Apps Script (GAS) Add-On. Specifically I'm trying to redeploy an existing container-bound (specifically sheets-bound) script I've written, with a Web-App, as an Add-On.

That original script implements a doGet(e) and doPost(e) as per GAS's HTML Service framework. It has been deployed via the Script Editor's Publish > Deploy as web app dialog:

Deploy as web app

The purpose of the Web App is to expose a UX for a given Sheet when this Add-On is enabled. If possible, how do you get a Sheet's Web-App endpoint programmatically? That is the Current web app URL in the following dialog:

Current web app URL

The goal is to only publish the Add-On privately for a given domain. My fallback is to manually install (e.g. copy & paste) the existing script in every Sheet I need it in.

1

1 Answers

1
votes

The getUrl() method of Service Class will return the web app URL.

ScriptApp.getService().getUrl()