Copy rows from spreadsheet to fusion tables with a script
August 17, 2011 1:42 AM Subscribe
How can I programaticaly copy ranges from google docs spreadsheet to a fusion table?
I would like to create an apps script in a google docs spreadsheet that will periodically copy rows from the sheet and insert them into a fusion table. Below I've pasted my best attempt, but it should be noted that I really want it to be posting a 2 column range, not that pair of values. That is just a placeholder.
This link here describes how to talk to fusion tables. I think this is the correct syntax for the POST request. http://code.google.com/apis/fusiontables/docs/developers_guide.html#Inserting
But I dont understand how to write the script to achieve this. I've messed around with it a bunch and I think I have these problems
-I'm not forming the post request correctly -I'm missing some sort of authentication step.
I am a total newb and what I have so far here is copy pasted below . Also below are a few links that I believe, together, contain the answer, but my understanding is too weak to implement it.
This guy seems to have figured out how to write an app script to send post requests http://blog.vivekhaldar.com/post/428652690/google-apps-script-spreadsheets-mashup-hub
This seems to be important
http://code.google.com/googleapps/appsscript/class_urlfetchapp.html
these people seem to be doing somthing very similiar, but I cant figure out how to make it work
http://groups.google.com/group/fusion-tables-users-group/browse_thread/thread/99db4db33e405f01
function deet() {
var advancedArgs = {
method: "post",
payload: "?sql=" + "INSERT INTO 1299801(Text, Number) VALUES ('Blue Shoes', 50)",
headers: {"Authorization": "Basic <base64 encoding of your username:passwd"}};
var response = UrlFetchApp.fetch(
"https://www.google.com/fusiontables/api/query",advancedArgs);
}
Thanks in advance!
posted by Popcorn to computers & internet (3 answers total) 1 user marked this as a favorite
posted by Monsieur Caution at 2:24 AM on August 17, 2011