user1585146
user1585146

Reputation: 1

how can I access HTTP GET variables in Google Apps Script?

I am trying to access the HTTP GET variables in a Google Apps Script (Like PHPs $_GET). I tried several techniques:

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

Answers (1)

Srik
Srik

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

Related Questions