My favorites | Sign in
Project Home Wiki Issues
New issue   Search
  Advanced search   Search tips   Subscriptions
Issue 535: User defined paramter in Script URL for Apps Script gadget in Sites
47 people starred this issue and may be notified of changes. Back to list
Status:  Fixed
Closed:  Jan 2012

Sign in to add a comment
Project Member Reported by, Apr 13, 2011
Request Summary:
1. Write this script
function doGet(e)
  var app = UiApp.createApplication();
  var site = SitesApp.getActiveSite();
  var label  = app.createLabel(e.parameter.test);

  return app;

2. Execute it as  standalone app with

3. Execute from Sites Page

The script embedded in Sites page is not able to read the parameter in the URL.

Apr 15, 2011
Project Member #2
(No comment was entered for this change.)
Summary: User defined paramter in Script URL for Apps Script gadget in Sites
Apr 27, 2011
If a script is to be used on multiple sites, a user parameter entered when the gadget is added to the site gives a way to make a general script, but still have some site specificity.
Jun 5, 2011
SitesApp.getActiveSite(); is very useful for site apps
Jun 6, 2011
It would be if it worked. Currently it does not work.
Jun 6, 2011
Probably those running on server side do not work.
Jun 6, 2011
It does not work in a gadget in a site. Create a simple Google Apps Script. Add it to a site as a Google Apps Script Gadget. getActiveSite does not work. It not working is a major problem.
Jul 20, 2011
Providing such capabilities for gadgets to receive URL parameters in google sites allows the basis of navigation through pages containing gadgets. As an example, if i want to create one page displaying a list of items, I would be very happy to navigate to a new page in the site dedicated to editing (or adding) items. 
Sep 1, 2011
Project Member #9
(No comment was entered for this change.)
Status: 5248569
Nov 18, 2011
What does "Status 5248569" mean ? Are you including this feature ?
In Sites scripts open the door to complex web app creation if we could send them some parameters !!
Nov 24, 2011
 I use iframe gadgets or I edit page's html content and append iframe tag for this problem ,if I need script embedded in Sites page with parameter.

but I cant use "SitesApp.getActiveSites()" for this case in script.
Jan 12, 2012
(No comment was entered for this change.)
Labels: -Component-OtherServices Component-SitesService
Jan 12, 2012
This issue has been fixed.
Please confirm that it is working for you.

Status: Fixed
Sep 12, 2012
this works, for me, but what i'd like to be able to do is pass the parameter within the google app script url in the google gadget so I didn't have to expose the parameters quite so publicly.  When I put a URL like:

into the google app script gadget, the test parameter gets removed :-(
Oct 12, 2012
I'm having the same trouble, URL query parameters are not passed when hosted in a Google Apps script gadget, but works fine when you enter the URL into a browser. I used the following work around:

function doGet(e) {
  var activePage = SitesApp.getActivePage(),
      title = activePage ? activePage.getTitle() : '';

  if ( === 'mypage' || title === 'mypage') {
  } else {

Nov 6, 2012
Hi, I don't see how your work around could enable to pass a specific parameter value (in the Googla Appscript gadget URL) for each time I "deploy" my script in a different Gsite.

that hasn't been fixed for now?

What about using an iframe to embed the script in the Gsite? Still doesn't work
Nov 16, 2012
I have a gadget embedded in a Google Site. The gadget URL which is embeded is similar to

function doGet(e) {
  var appParam =;

appParam = "scores"

This works for me. I just change the parameter value each time you embed the script on a different page.
Apr 29, 2013
I am a Google Apps for business user, the following Google Apps web app script URL works fine from the browser (parameters modified for privacy reasons):
When I use the same URL in Google Sites Apps Script Gadget, the parameters are not passed to the script/web app.
Is the bug still around or am I doing anything wrong?
May 6, 2013
Re comment #20.

There is apparently an issue with the apps script gadget in Sites, as parameters after the URL are not being passed.

As a work-around, I've found that I can use the URL of the Site Page itself - in my case, I had several dozen pages that were going to invoke the same script with a parameter to tailor the queries performed to populate a DataTable.

function doGet(e) {
  var customQuery = e.parameter.customQuery || '';
  // Work around for
  var pg = SitesApp.getActivePage();
  var pgURL = '';
  if ( pg !== null ) pgURL = pg.getUrl();
  // Now disassemble pgURL to figure out what the query should be

Apr 18, 2014
nice trick; I am in the same situation. A shame though that parameters are not passed.
Sign in to add a comment

Powered by Google Project Hosting