Skip to content

Instantly share code, notes, and snippets.

Created January 31, 2012 23:10
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Google Apps Script Snippet to read data pushed via GET (in this case from Google Refine)
// script used in
function setup(){
ScriptProperties.setProperty('active', SpreadsheetApp.getActiveSpreadsheet().getId());
function doGet(e){
var secret ="lemons"; //must match secret in Google Refine
if (e.parameter.secret == secret){
var ss = SpreadsheetApp.openById(ScriptProperties.getProperty('active'));
var sheet = ss.getSheetByName("Vertices"); // sheet name of where you want the data to go
var idx = parseInt(e.parameter.idx); // I had an idx column sequentially numbered to give me a row index
var geo = e.parameter.geo; // I was passing back some geo data, you can add more variables as long as their name matches what is being passed in the querystring
sheet.getRange(idx+1,25).setValue(geo); // idx+1 is because I had a header row and 25 is the column number
var app = UiApp.createApplication(); // included this part so something is returned to refine so that we can filter for errors
var label = app.createLabel("VALUE ADDED"); // can be anything you like
return app;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment