Jason Allshorn
Jason Allshorn

Reputation: 1625

Google Appscript doGet() doesn't return parameters, but returns html of web app

I feel like I'm totally missing something about how to get back the results from a function call to a doGet() Google appscript. Please can anyone suggest what I'm doing wrong.

Using a HTTP GET request all I get back is the entire html content from the app and the doGet() hasn't executed.

my doGet() looks like this.

function doGet(e) {
  var params = JSON.stringify(e);
  return HtmlService.createHtmlOutput(params);
}

The returned data looks like this.

enter image description here

Upvotes: 1

Views: 2081

Answers (1)

Jack Brown
Jack Brown

Reputation: 5892

I think you are looking for ContentService rather than HtmlService

Something along the lines of this:

function doPost(e) {
  return ContentService.createTextOutput(JSON.stringify(e))
}

HtmlService will output a HTML page

Authorization Also, make sure you have "anyone even anonymous" can run the web app option selected under "Publish>Deploy>Web app" Window.

Upvotes: 4

Related Questions