How to pass parameters to Google Apps Script Gadget embedded in a Sites Page?

Maybe the link bellow will help you - I have not tried it myself yet...but I will try it out in the next days. http://code.google.com/p/google-apps-script-issues/issues/detail?id=535


I posted this on the code.google.com page linked in the accepted answer, but the way to have parameters passed through to Apps Script is by adding "https://sites.google.com/feeds" to the Apps Script scope. (See this site for information about how to add explicit scopes.) Once this scope is added, the following works:

in Code.gs:

function doGet(e) {

  var htmlTemplate = HtmlService.createTemplateFromFile("page");
  htmlTemplate.urlParams = e.parameters;
  return htmlTemplate.evaluate();

}

in page.html:

...
<head>
...
<script>urlParams = <?!= JSON.stringify(urlParams) ?>;</script>
</head>
...

urlParams is now available as a variable in your JS code in the following form:

urlParams = { key1: [value1, value2, ...], key2: [value1, value2] }