When you build a script with a user interface, either via Html Service or Ui Service , you can deploy the script as a web app so users can access it. For example, if you build a script that allows users to schedule appointments with members of a support team, you can deploy that script as a web app so your users can access it directly.
Requirements for Web Apps
In order to deploy a script as a web app, it must contain the
doGet(e) function. User interfaces for web apps can be built using either the Html Service or the Ui Service (including the use of the GUI Builder).
Before you can deploy a web app, you must save a version of your script. To do so, choose File > Manage Versions in the Script Editor, provide a description for the version, and then click Save New Version.
Deploying Your Script as a Web App
Once you have created your web app and saved a version, you can deploy it from the Script Editor. Choose Publish > Deploy as web app from the menu. A dialog will appear where you will need to make three decisions about how to publish your web app:
- Project version: Which saved version do you want to publish?
- Execute the app as: Do you want the web app to execute as you (the owner of the script) or as the active user who is accessing the web app?
- Who has access to the app: The options for this select box will differ depending on the type of account you have, but they can include only yourself, any member of your domain, anyone, or anyone including allowing anonymous access.
Once you've selected the options you want to use for your web app, click the Deploy button. You'll see a new dialog with a message indicating that your project has been successfully deployed as a web app. Below that message you'll find the URL of your web app. Copy that URL and use it to access your web app in a browser.
Permissions and Web Apps
The permissions for a web app differ depending on whether you chose to execute the app as you (the owner of the script) or as the active user who is accessing the web app.
If you chose for the script to execute as you, then the script will always execute under your identity, that is, the identity of the owner of the script. This will be the case regardless of which user is accessing the web app.
If you chose for the script to execute as the active user who is accessing the web app, then the script will execute under the identity of the active user who is accessing your script.