Class Service

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

  • ThegetUrl() method returns the URL of a deployed web app ornull if not deployed.

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

  • Thedisable() 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 returnsnull.
isEnabled()BooleanReturnstrue if the script is accessible as a web app.

Deprecated methods

MethodReturn typeBrief description
disable()voidDisables the script from being accessed as a web app.

Detailed documentation

getUrl()

Returns the URL of the web app, if it has been deployed; otherwise returnsnull. If youare 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()

Returnstrue 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

disable()

Deprecated. This function is deprecated and should not be used in new scripts.

Disables the script from being accessed as a web app. This method is equivalent to opening the"Publish > Deploy as web app" dialog and clicking "disable web app".

ScriptApp.getService().disable();

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-11 UTC.