Class Service

  • The Service class allows access and manipulation of script publishing, specifically for web apps.

  • The getUrl() method returns the URL of a deployed web app or null if not deployed.

  • The isEnabled() method indicates whether a script is accessible as a web app.

  • The disable() method, though deprecated, was used to disable a script from being accessed as a web app.

Service

Access and manipulate script publishing.

Methods

MethodReturn typeBrief description
getUrl()StringReturns the URL of the web app, if it has been deployed; otherwise returns null.
isEnabled()BooleanReturns true if the script is accessible as a web app.

Detailed documentation

getUrl()

Returns the URL of the web app, if it has been deployed; otherwise returns null. If you are running the development mode web app, this returns the development mode url.

// Mail the URL of the published web app.
MailApp.sendMail(
    'myself@example.com',
    'My Snazzy App',
    `My new app is now available at ${ScriptApp.getService().getUrl()}`,
);

Return

String — the URL of the web app


isEnabled()

Returns true if the script is accessible as a web app.

Return

Booleantrue if the script is published as a web app; false if not

Deprecated methods