If you build a user interface for a script, you can publish the script as aweb app. For example, a script that lets users schedule appointments withmembers of a support team would best be presented as a web app so thatusers can access it directly from their browsers.
Both standalone scripts andscripts bound to Google Workspace applicationscan be turned intoweb apps, so long as they meet the requirements below.
Requirements for web apps
A script can be published as a web app if it meets these requirements:
Apps Sites For Ipad
- It contains a
doGet(e)
ordoPost(e)
function. - The function returns an HTML service
HtmlOutput
object or aContent serviceTextOutput
object.
Request parameters
Design your own web apps. Step 1: Create a script. Note: You can’t import Apps Scripts, but you can copy and paste the script into a new file on your site. On a computer, open a site in classic Google Sites. Click More actions Manage site. Click Apps Scripts. To create a script in the editor, click Add new script. Embedding a web app in new Sites. In order to embed a web app, it must first be deployed. You also need the Deployed URL from the Deploy dialog. To embed a web app into a new Sites page, follow these steps: Open the Sites page where you'd like to add the web app. Select Insert Embed URL. Paste in the web app URL and then click ADD.
When a user visits an app or a program sends the app an HTTP GET
request,Apps Script runs the function doGet(e)
. When a program sends the app an HTTPPOST
request, Apps Script runs doPost(e)
instead. In both cases, the e
argument represents an event parameter that can contain information about anyrequest parameters. The structure of the event object is shown in the tablebelow:
Fields | |
---|---|
e.queryString | The value of the query string portion of the URL, or |
e.parameter | An object of key/value pairs that correspond to the request parameters. Only the first value is returned for parameters that have multiple values. |
e.parameters | An object similar to |
e.contextPath | Not used, always the empty string. |
e.contentLength | The length of the request body for POST requests, or |
e.postData.length | The same as |
e.postData.type | The MIME type of the POST body |
e.postData.contents | The content text of the POST body |
e.postData.name | Always the value 'postData' |
For instance, you could pass parameters such as username
and age
to a URL as shown below:
Then, you can display the parameters like so:
In the above example, doGet(e)
returns the following output:
c
sid
Deploy a script as a web app
To deploy a script as a web app, follow these steps:
New editor
- At the top right of the script project, click Deploy > New deployment.
- Next to 'Select type,' click Enable deployment types > Web app.
- Enter the information about your web app in the fields under 'Deploymentconfiguration.'
- Click Deploy.
Legacy editor
- Save a new version of the script byselecting File > Manage Versions, then Save New Version.
- Select Publish > Deploy as web app.
- Under Project version, select the version you just saved.
- Under Execute the app as, select whoseauthorization the appshould run with: your account (the developer's) or the account ofthe user who visits the app (see permissions).
- Under Who has access to the app, select who should be allowedto visit it. The options differ depending on the type of accountyou have, but they can include 'Only myself', any member of yourdomain, 'Anyone' (with a Google account), or 'Anyone, even anonymous'.
- Click Deploy.
After you deploy your web app, the dialog that confirms your deployment and providesthe deployed URL. This URL ends in /exec
and is for the deployed version ofyour app, based on the last version you saved and deployed.
You can share the web app URL with those you would like to use your app,provided you have granted them access.
Note: Web apps deployed in one domain cease to function if their ownershipchanges to a shared driveor account in a different domain. This can be corrected by having thenew owner or collaborator redeploy the web app in the new domain. Alternatively,if the web app is moved back to its original domain the web app will startfunctioning again for that domain without redeploying.Test a web app deployment
New editor
To test your script as a web app, follow the steps below:
- At the top right of the script project, click Deploy > Testdeployments.
- Next to 'Select type,' click Enable deployment types > Web app.
- Under the web app URL, click Copy.
- Paste the URL in your browser and test your web app.
This URL ends in /dev
and can only be accessed by users who have edit accessto the script. This instance of the app always runs the most recently savedcode and is only intended for testing during development.
Legacy editor
After you deploy your web app, the dialog that confirms your deploymentprovides a link to test your latest code.This URL ends in /dev
and can onlybe accessed by users who have edit access to the script. This instance of theapp always runs the most recently saved code — not necessarily a formalversion — and is intended for testing during development.
Permissions
The permissions for a web app differ depending how you choose to executethe app:
- Execute the app as me—In this case, the script always executesas you, the owner of the script, no matter who accesses the web app.
- Execute the app as user accessing the web app—In this case, the scriptruns under the identity of the active user using the web app. This permissionapproach causes the web app to show the email of the script owner when the userauthorizes access.
Embedding your web app in Google Sites
You can also embed web apps in both the classicand new versions of Google Sites.
Warning: Embedded web apps are still subject to access permissions to preventmalicious use. If your embedded web app doesn't seem to be working, check to seeif the permissions set by the web app owner and the domain administrator allowits use.Embedding a web app in new Sites
In order to embed a web app, it must first bedeployed. You alsoneed the Deployed URL from the Deploy
dialog.
To embed a web app into a new Sites page,follow these steps:
- Open the Sites page where you'd like to add the web app.
- Select Insert > Embed URL.
- Paste in the web app URL and then click ADD.
The web app appears in a frame in the page's preview. When you publishthe page, your site viewers may need to authorize the web app before itexecutes normally. Unauthorized web apps present authorization prompts tothe user.
Embedding a web app in classic Sites
You can bind a script to aclassic Google Site in much the same way as a youcan bind a script to a Google Doc or Sheet. To create a bound script, visityour site, click the gear icon,then select Manage site. On the Manage Site page, click Apps Scripts in the left nav, then the Add new scriptbutton. This opens a new script in the Apps Script editor, where you cancode and deploy your web app.
You can also embed your web app in a page. You can bind the web app to theSite or you can use any web app that you have the URL for. To embed aweb app into a Google Sites page, follow the steps below:
- Open an existing Site for which you have edit access or create a new Site.
- Navigate to the page in your Site where you want to embed the web app.
- Click the edit icon, and then Insert > Google Apps Script.
- Choose the script from the list that represents your web app. If your webapp is not bound to this Site, you can paste in the web app URL instead.
- Click the Select button, choose the desired options from the nextdialog, and click Save.
- Save your changes to the page and then you should see your web app embeddedin your Sites page.
Sides Apps
Web Apps and Browser History
It can be desirable to have an Apps Script web app simulate a multi-pageapplication, or one with a dynamic UI controlled via URL parameters.In order to do this well, you can define a state object to represent the app'sUI or page, and push the state into the browser history as theuser navigates your app. You can also listen to history events so that your webapp displays the correct UI when the user navigates back and forth with thebrowser buttons. By querying the URL parameters at load time, you can have yourapp dynamically build its UI based on those parameters, allowing the user tostart the app in a particular state.
Apps Script provides two asynchronous client-side JavaScript APIs to assistwith creating web apps that are linked to the browser history:
google.script.history
provides methods to allow dynamic response to browser history changes. Thisincludes: pushing states (simple Objects you can define) onto the browserhistory, replacing the top state in the history stack, and setting a listenercallback function to respond to history changes.google.script.url
providesthe means to retrieve the current page's URL parameters and URL fragment, ifthey are present.
These history APIs are only available to web apps. They are notsupported for sidebars, dialogs or add-ons. This functionality is alsonot recommended for use inweb apps embedded in a Google Sites.
-->As a SharePoint or global admin in Microsoft 365, you can create an App Catalog site to make internally developed custom apps available for users to install when they browse apps under the From Your Organization filter on the Site Contents page. Site owners can then add these apps to customize sites with specific functionality or to display information.
After the App Catalog site has been created, you can use it to upload any custom apps that your organization has developed. Uploading custom apps isn't much more complicated than uploading a document to a library and setting some properties. You can use the App Catalog site to do things like install custom or third-party apps on sites for users (also called app deployment). You can also manage app requests from users.
For more information about your options for developing custom apps for SharePoint, see: Build apps for SharePoint and Apps for SharePoint compared with SharePoint solutions.
Step 1: Create the App Catalog site collection
The first step is to create the App Catalog site collection if it hasn't already been created.
Even if you don't plan to make internal custom apps available, you will not be able to do things like change the purchase settings for the SharePoint Store until you create the App Catalog site collection. You can have only one App Catalog site collection for your organization, and you only need to create it once.
- Go to the More features page of the new SharePoint admin center, and sign in with an account that has admin permissions for your organization.
Note
If you have Office 365 Germany, sign in to the Microsoft 365 admin center, then browse to the SharePoint admin center and open the More features page.
If you have Office 365 operated by 21Vianet (China), sign in to the Microsoft 365 admin center, then browse to the SharePoint admin center and open the More features page.
Stiles Apps
Under Apps, select Open.
Select App Catalog.
If the App Catalog site doesn't open, select Create a new app catalog site, and then select OK.
On the Create App Catalog Site Collection page, enter the required info, and then select OK. The App Catalog site will start the provisioning process. It may take a couple of hours for it to appear.
Step 2: Add custom apps to the App Catalog site
To get to the App Catalog site once it's been created, follow steps 1 and 2 in the previous section. The site may take a little time to appear. The App Catalog site will have a document library for Apps for Office and a document library for Apps for SharePoint, as well as a list that tracks App Requests from site users.
On the home page of the App Catalog site, select the tile labeled either Distribute apps for SharePoint or Distribute apps for Office, depending on which type of app you are uploading.
Select New, and browse to the app you want upload, or drag the app into the library.
Note
Depending on the functionality that the app provides, the developer can set a flag that allows you to make the app available to all sites in the organization. If the app builds something (for example, it creates a new list), you can't make it available to all sites and will need to deploy it as described in the next section under 'Deploy a custom app.' We always recommend testing solutions before deploying them more broadly. If the 'Do you trust' dialog appears when you upload the app, and you want to make the app available to all sites in your organization, select Make this solution available to all sites in the organization, and then click Deploy.
To help site owners identify and use the app, right-click it, and then select Properties.
In the properties dialog form, you can change the Name for the app and enter optional information like a description, images, category, publisher, and support URL. Follow the instructions on the screen for details like image size.
Make sure the Enabled check box is selected so that users are able to add this app to sites.
If it appears, in the Hosting Licenses box, specify the number of licenses you think you will need.
Select Save.
Note
If you want to make third-party apps available for users to find and install, you simply need to buy a site license for them. When you buy a site license for a third-party app from the SharePoint store, the apps will automatically display under Apps You Can Add.
Step 3 (optional): Install an app for users
If you want all users to use an app, you can deploy it to specific site collections, managed paths, or site templates. Deploying an app essentially installs that app on a site for users so that is available for use. Deployed apps appear on the Site Contents page for a site.
Apps Sites For Pc
You can deploy a third-party app, or you can deploy a custom app.
Note
This option is only available for SharePoint add-ins. To see tenant-scoped deployment options for SharePoint Framework solutions, see Tenant-scoped solution deployment for SharePoint Framework solutions.
Deploy a third-party app
If you buy a site license for a third-party app, then that app is automatically available for users to install when they browse apps under Apps You Can Add.
However, if you want to make the app available for use without requiring users to find and install it, you can deploy it.
If you have not already purchased the app, you must buy it first. For info about how to do this, see Buy an app from the SharePoint Store.
On the App Catalog site, select Settings, and then select Add an app.
Select the app you want to add, and when prompted, select Trust It.
On the Site Contents page, find the app you want to deploy.
Select ... (ellipses icon) next to the app, and to view the menu, select ... (ellipses icon) again in the callout, and then select Deployment. (For some apps, the Deployment command may appear on the first callout.)
On the Manage App Deployments page, enter the URL for each site collections to which you want to deploy the app, and to add it to the list, select Add .
In the Managed Paths section, to specify which managed paths should have this app available, select Add.
In the Site Templates section, to specify which site templates should have this app available, select Add.
Select OK.
If you are prompted to Trust the app, select Trust It.
Deploy a custom app
If you upload a custom app to the App Catalog, it is automatically available for users to install when they browse apps under From Your Organization. If you want you want the app to be available for use without the need for site users to install it, you can deploy it.
Before you can deploy a custom app, you must first upload it to the App Catalog site. For step-by-step guidance about how to do this, see the previous section, Step 2: Add custom apps to the App Catalog site.
After you have uploaded the app, you then must add it as an app to the App Catalog site so that it appears on the Site Contents page for the App Catalog itself. On the App Catalog site, go to Settings and then click Add an app.
Select the app you want to add, and when prompted, select Trust It.
On the Site Contents page, find the app you want to deploy.
Next to the app, select ... (ellipses icon), and to view the menu, select ... (ellipses icon) again in the callout, and then select Deployment. (For some apps the Deployment command may appear on the first callout.)
On the Manage App Deployments page, enter the URL for each site collections to which you want to deploy the app, and to add it to the list, select Add.
In the Managed Paths section, to specify which managed paths should have this app available, select Add.
In the Site Templates section, to specify which site templates should have this app available, select Add.
Select OK.
If you are prompted to Trust the app, select Trust It.
Note
It may take up to 30 minutes for an app to deploy.
If you deploy an app that adds commands to the item callout for document libraries or lists, then those commands are visible to users. However, if you deploy an app that features custom ribbon controls or an App Part, additional steps may be required to make the user interface commands for the app appear.
Remove an app from the App Catalog
If you no longer want a specific app to be available for users to install, you can remove it from the App Catalog. Any instances of the app that have already been added to sites by users will remain, but the app will no longer be available for users to add to additional sites.
On the App Catalog site, select the Apps for SharePoint list.
Right-click the app that you want to remove, and select Delete.
In the dialog, to confirm that you want to send the item to the site Recycle Bin, select OK.