How to get a URL string parameter passed to Google Apps Script doGet(e) -


given url:

https://script.google.com/macros/s/macroname/dev?thearg="69.28.15.332" 

the important part on end:

?thearg="69.28.15.332" 

i'm trying pass information apps script in url. why won't .gs google apps script function value of string @ end of url? doget(e) function.

function doget(e){   var passedinip = e.parameter.thearg;   logger.log(passedinip);    if (passedinip === "69.28.15.332")    {     return htmlservice.createhtmloutput("<h2>something</h2>")   } }; 

i error msg printed in browser:

the script completed did not return anything

the logger.log log something. logs [date time edt] "69.28.15.332" , value same in log, value i'm checking for. equality test fails.

the argument passed "as is", can test using code below :

function doget(e){   var passedinip = e.parameter.thearg;   logger.log(passedinip);    if (passedinip == "69.28.15.332")    {     return htmlservice.createhtmloutput("<h2>something</h2>")   }     return htmlservice.createhtmloutput(passedinip) };  

this return "69.28.15.332" including quotes...

so have 2 possibilities choose :

  1. remove quotes in url
  2. add quotes in condition '"69.28.15.332"' (single quotes+quotes)

i choose first 1 no reason ;-)


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -