javascript - Send HTTP Post When Google Spreadsheet Updated -
i have spreadsheet submitted 3rd party apps (which can't change code).
then, need send http (post) automatically http://thisismyurl.url/go.aspx?fieldone=xxx&fieldtwo=xxx when google spreadsheet updated.
what in mind create script in google spreadsheet , use urlfetchapp in code.
function sendhttppost() { //how pick data field in last column (everytime google spreadsheet updated)? var data = { "fieldone" : "value field 1 (from last column)", "fieldtwo" : "value field 2 (from last column)", }; var options = { "method" : "post", "payload" : data }; urlfetchapp.fetch("http://thisismyurl.url/go.aspx", options); }
i know missed command fetch data spreadsheet. idea this?
thanks helping me :)
thanks @mogsdad giving clue me. , @zig mandel suggesting me read spreadsheetapp documentation.
here did in code, , it's works!
// spreadsheet object var spreadsheet = spreadsheetapp.getactivespreadsheet(); // set first sheet active spreadsheetapp.setactivesheet(spreadsheet.getsheets()[0]); // fetch sheet var sheet = spreadsheet.getactivesheet(); // figure out last row var lastrow = sheet.getlastrow(); var lastcolumn = sheet.getlastcolumn();
at last command, use urlfetchapp classes fetch(url) method learn here
thanks helping me. , others too. yeay!!!
Comments
Post a Comment