0

I am trying to pass parameters to an app script embedded in page on google sites. This page was created using a custom template that has the original script. Everything works on the template but on the page itself, i get an 'undefined' when I try to use the values.

I am using the usual e.parameter.name code in the doGet(e) to get the value for the parameter 'name'. I do not understand why it works for the template but not for the page with the same template.

nupac
  • 2,459
  • 7
  • 31
  • 56
  • How are you passing the parameters? You cant in the script url, only from the site url itself will it pick up parameters. – Zig Mandel Jan 30 '14 at 13:48

3 Answers3

1

You cant pass parameters to the script from the embedded script url. Gas only picks up parameters from sites if those are in the site url itself. As a workarround you can embed the gas url (with params) using the iframe gadget instead of inserting the script the normal way.

Zig Mandel
  • 19,571
  • 5
  • 26
  • 36
0

Try using parameters:

function doGet(e) {
   Logger.log(e.parameters.name[0]);
}
wchiquito
  • 16,177
  • 2
  • 34
  • 45
0

Make sure you use the right link as well. Especially in an iframe in Google Sites. This one works for me, which changes macro.google.com to sites.google.com and makes other changes as well:

https://sites.google.com/macros/s/~~script ID~~/exec?param1=~~passed value~~&param2~~passed~~
Karl_S
  • 3,364
  • 2
  • 19
  • 33