Reputation: 1
I am trying to access the HTTP GET variables in a Google Apps Script (Like PHPs $_GET). I tried several techniques:
Plain java script (window.location), which obviously is not supported
Googles own Service through SitesApp.getActivePage().getUrl(). Gives me the URL, but without the variable string. On second thought this might make sense.
I'd really appreciate some pointers or a working example, thanks.
As per the comment from Srik I tried the following:
function doGet(e) {
UserProperties.setProperty("bottleid", e.parameter.id);
return HtmlService.createTemplateFromFile('showbottledata').evaluate();
}
Which gives me the mentioned TypeError: Cannot read property "parameter" from undefined. (line 2) error.
Upvotes: 0
Views: 1606
Reputation: 7957
First, you need to define your doGet in such a way that it accepts URL parameters
function doGet(e) {
....
}
When you call your URL using URL parameters, say parm1=val1, use
var parm1 = e.parameter.parm1 ;
Upvotes: 1