Google Sites - tbd‎ > ‎How To...‎ > ‎

Add a Site Script - r#d

Deprecation Application programming interface Method Computer Software,  text, logo png | PNGEgg
To use a Google Sites script, either one copied from Sample Scripts or from elsewhere, follow these steps:
  1. Open the page containing the script you want to use in one window
  2. In another window, open your Site
  3. Goto More Actions>Manage Site and under Site Content, click on the Apps Script Link
  4. Click Launch Editor and delete the default script
    "function myFunction({
  5. Copy the script you want to use from your first window and paste it into the Script Editor Window
  6. Save the Script... give it an appropriate name when prompted
  7. Close the script editor

Using the script.

To run a function in a given script you need to create a link to a function in the script.
  1. Go to the page where you want to be able to run the script from
  2. Edit the page
  3. Place the cursor where you want a link to the script  and type 'Click Here' or something similar (or insert an image to be used as a button)
  4. Highlight the text Click Here and click on 'Link' in the editor toolbar
  5. Select Apps Script and select the function within the script that you want to be run  and select OK
Now when anyone clicks the link, the function in the script will be run. (They will need to authorise the script first.)