Created
June 9, 2010 12:47
Revisions
-
psychemedia created this gist
Jun 9, 2010 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ // Simple spreadsheet, with first sheet containing form submission repsonses // when the form is submitted: // 1) grab the latest response, // 2) post it to a third party service via an HTTP POST function testWebhook() { var ss = SpreadsheetApp.openById(SPREADSHEET_ID); var form=ss.getSheets()[0]; var lr=form.getLastRow(); var el=form.getRange(lr,2,1,1).getValue(); var t=el; //The following escape palaver is gleaned from a Google help forum... var p="val1="+encodeURIComponent(t).replace(/%20/g, "+")+"&val2="+encodeURIComponent(form.getRange(lr,3,1,1).getValue()).replace(/%20/g, "+"); // Here's where we do the callback... var x=UrlFetchApp.fetch('http://www.postbin.org/YOURPASTEBINID',{method: 'post', payload: p}); }