Search
Clear search
Close search
Google apps
Main menu

Use scripts to do tasks on your site

If you want your site to do tasks automatically for visitors, you can add Google Apps scripts. For example, you can:

  • Send emails and Calendar invites
  • Create new content based on your users
  • Design your own web apps for your page

To learn about Google Apps Script, try this tutorial or getting started guide.

This article is for the classic Google Sites (no “Publish” button at the top right). Get help for the new Google Sites.

Step 1: Create a script

You can create or edit Google Apps scripts using Sites.

Note: You can’t import Apps Scripts, but you can copy and paste the script into a new file on your Google Site.

  1. Open your website in Google Sites.
  2. Click More actions More actions and then Manage site.
  3. Click Apps Scripts.
    • To create a new script in the editor, click Add new script.
    • To edit an existing script, click the script in the list.
  4. Edit or paste the script.
  5. Optional: To test your script, go to the toolbar and click Play Play. If you’re asked for permission, click Allow.
  6. In the "File" menu, click Save or Save all.

Step 2: Add your script

You can add your script to a page in two different ways. If you want it to run automatically, add it as a gadget, but if you want it to run when clicked, add it as a link.

Option 1: Add as a gadget

To run your script for a visitor who opens your page, add it as a gadget.

Important: The gadget can access and edit any content your Google Account can.

  1. Open your website in Google Sites.
  2. Go to the page you want to edit.
  3. Click Edit Edit.
  4. Click where you want to insert the script.
  5. Click Insert and then Apps Script.
  6. Follow the instructions in the window.
Option 2: Add as a link

To run your script when someone signed in to their Google Account clicks a link, add it as a link.

  1. Open your website in Google Sites.
  2. Go to the page you want to edit.
  3. Click Edit Edit.
  4. Select the text you want to link.
  5. Click Link Link.
  6. Click Apps Script and then click the script you want to link to.
  7. Click Ok.
  8. Click Save.
Was this article helpful?
How can we improve it?