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.

1
  • How are you passing the parameters? You cant in the script url, only from the site url itself will it pick up parameters. Commented Jan 30, 2014 at 13:48

3 Answers 3

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.

Sign up to request clarification or add additional context in comments.

Comments

0

Try using parameters:

function doGet(e) {
   Logger.log(e.parameters.name[0]);
}

Comments

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~~

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.