google apps script - Import rows in Fusion Tables fails -


i can't seem import rows google fusion correctly. 503 backend error. google apps script code below.

var getdataurl = 'https://www.googleapis.com/fusiontables/v1/tables/{tableid}/import?key='+{apikey};

var ssdown = spreadsheetapp.openbyid({spreadsheet id}).getdatarange().getvalues();

var options = { "method" : "post", "contenttype" : "application/json", "headers" : { "authorization" : "bearer " + {token}, "accept" : "application/json", }, 'encoding' = 'auto-detect', 'payload' = ssdown.tostring(); } };

var output = urlfetchapp.fetch(getdataurl,options).getcontenttext();

the issue caused careless coding on part. correct code is:

var getdataurl = 'https://www.googleapis.com/upload/fusiontables/v1/tables/{tableid}/import'; var options = { "method" : "post",               "contenttype" : "application/octet-stream",               "headers" : {                 "authorization" : "bearer " + {token},                 "accept" : "application/json",               },             } var ssdown = spreadsheetapp.openbyid({sheetid}).getdatarange().getvalues().tostring(); options.payload = ssdown; var output = urlfetchapp.fetch(getdataurl,options).getcontenttext(); 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -