how to send data through URL in Google app Script? -
i need send data of spreadsheet other server, i've tried this.i not getting error not working too.
i tried lots of things no joy.
var ss = spreadsheetapp.getactivespreadsheet(); function onopen() { var menuentries = [ {name: "send plm", functionname: "email"} ]; ss.addmenu("mymenu", menuentries); } function email() { //browser.msgbox("hello world"); //var url = "http://********/noetic_data/adddatatoaras?data="; var sheet = spreadsheetapp.getactivesheet(); var rows = sheet.getdatarange(); var columns = sheet.getdatarange(); var numrows = rows.getnumrows(); var numcolumns = rows.getnumcolumns(); var values = rows.getvalues(); (var = 0; <= numrows - 1; i++) { (var j = 0; j <= numcolumns - 1; j++) { var row = values[i][j]; var cell = sheet.getrange(i+1,j+1); } } logger.log(numrows+"::"+numcolumns); var exceldata = ""; for(var k=0;k<values.length;k++) { if(exceldata == "") { exceldata = values[k]; } else { exceldata = exceldata +"|"+ values[k]; } } browser.msgbox(exceldata) ; return exceldata; //var url = "http://*****/noetic_data/adddatatoaras?data="+exceldata; var response = urlfetchapp.getrequest("http://******/noetic_data/adddatatoarasdata=", exceldata) //fetch("******/noetic_data/adddatatoaras?data=", exceldata); logger.log(response.getcontenttext()); // s = s+exceldata; //return s; }
var ss = spreadsheetapp.getactivespreadsheet(); function onopen() { var sheet = spreadsheetapp.getactivesheet(); var rows = sheet.getdatarange(); var columns = sheet.getdatarange(); var numrows = rows.getnumrows(); var numcolumns = rows.getnumcolumns(); var values = rows.getvalues(); (var = 0; <= numrows - 1; i++) { (var j = 0; j <= numcolumns - 1; j++) { var row = values[i][j]; var cell = sheet.getrange(i+1,j+1); } } var exceldata = ""; for(var k=0;k<values.length;k++) { if(exceldata == "") { exceldata = values[k]; } else { exceldata = exceldata +"|"+ values[k]; } } //bowser.msgbox(exceldata) ; //***to view data on browser**** var shui = spreadsheetapp.getui(); var app = uiapp.createapplication().settitle('custom functions'); var panel = app.createverticalpanel().add(app.createhtml('click button bellow send data plm') .setstyleattribute('padding','10px')); var grid = app.creategrid(1,2).setwidth('200'); var b1 = app.createbutton("send plm"); var link = app.createanchor('xxxxx',"http://***.**.*.***/noetic_data/adddatatoaras?data="+exceldata).setstyleattributes({'zindex':'1' , 'position':'fixed' , 'top':'45' , 'left':'20', 'color':'transparent' }).settitle('proceed in new tab'); var g1 = app.createverticalpanel().add(b1).add(link); grid.setwidget(0,0,g1); app.add(panel).add(grid) shui.showsidebar(app); }
Comments
Post a Comment