In demand


Friday, September 4, 2015

The Worst of Stackoverflow - question/14914955 is a  site that  tries to  help developers and programmers. Unfortunately it fails miserably at the task due to restrictions over moderation. It also is based on a model that  does not help or teach  new comers  and it  bores  advanced developers to death.  This is a chronicle of some of the websites most glaring problems.

This is a good question and an absolutely correct answer. The problem is that it requires knowledge that the asking party does not possess. Teaching  them  requires a entirely different  information exchange  format.  One that stackoverflow does not support.  The fact that the asking party looked around supports this as they would have had much better information and might have been able to accomplish something had  the answering person  been  able to use  "I created a tutorial for you at my blog".

How to Call Google Apps Script from Web Page

Have searched high and low for this. I have a web page of basic HTML/CSS/JS. I want users to be able to visit the page and upon opening page, a call is made to a google script I made which takes information from a spreadsheet and displays some of it on the page. I am hoping I don't have to do any fancy set up like in Google's tutorials because none of them were helpful to me.

My Webpage ----> Google Script ----> Google Spreadsheet
My Webpage <---- Google Script <---- Google Spreadsheet

Users should be able to select an item shown on the webpage (item populated from spreadsheet) and click a button which will allow users to enter a new page with a URL derived from the selected item.

This is essentially a chat room program where the chat rooms are stored on a spreadsheet. I want users to be able to create a new chat room as well which should update the google spreadsheet.

asked Feb 16 '13 at 20:49


Look into using the GET parameters.

Here's a previous question on the topic.

You can access the parameters passed by GET in your doGet(e) function using e.parameter. If you call, then

function doGet(e) {



doSomething will be written to the log, in this case.

Returning data from the script can be done using the ContentService, which allows you to serve JSON (I recommend). JSON is easiest (in my opinion) to make on the GAS end, as well as use on the client end.

The initial "populate list" call would look something like this. I will write it in jQuery because I feel that is very clean.

var SCRIPT_URL = "[....PUT YOUR SCRIPT URL HERE....]/exec";

$(document).ready(function() {



              function (data) { 




And the corresponding GAS that produces this.

function doGet(e) {

  if (e.parameter.method=="populate_list") {

    var v = {cat:true,dog:false,meow:[1,2,3,4,5,6,4]}; //could be any value that you want to return

    return ContentService.createTextOutput(e.parameter.callback + "(" + Utilities.jsonStringify(v) + ")")




This method is called JSONP, and it is supported by jQuery. jQuery recognizes it when you put the ?callback=? after your URL. It wraps your output in a callback function, which allows that function to be run on your site with the data as an argument. In this case, the callback function is the one defined in the line that reads function (data) {.
edited Feb 18 '13 at 14:58
answered Feb 16 '13 at 21:14
Phil Bozak

Though I am still lost, I am sure your answer is correct. –  carter Feb 16 '13 at 22:39
I added a couple of sample segments of code. Hope this helps! –  Phil Bozak Feb 16 '13 at 23:12
Absolutely great answer Phil! –  ScampMichael Feb 16 '13 at 23:24
@Michael - I agree, he is for sure the next number one on this forum (just wait a couple of days ^^) –  Serge insas Feb 18 '13 at 17:02

Sorry guys,  Looks like both Carter and Phil have moved on.  Who could blame them? Years of C.S.  studies being restricted to answering questions in their simplest terms. For use by those who have little or no interest in learning through trial and error.  Just looking for a quick solution written by someone else.

Or is it typical of what happens when two software engineers meet to answer a question?

But at least Carter made the outcome available to all. Just not on Stackoverflow. Again proving that allowing people not to interact in their own way does not build a resource for knowledge.

Today's Links

Post a Comment

Print this!