Hari Das
Hari Das

Reputation: 10864

Google Spreadsheet URL with Query Does not support callback?

I am trying to develop an application where I am going to fetch data from Google Spreadsheet on some conditions. I use following URL to fetch data. The data comes in JSON and it work perfectly if I am entering the URL in address bar.

https://docs.google.com/spreadsheet/tq?tqx=out:json&tq=select%20*%20%20where%20B%20%3D%20%27&KEY=MY_SPREADSHEET_KEY

When I am going to fetch it from JavaScript using callback (JSONP) it does it receive data.

var resource = document.createElement('script'); 
resource.type = 'text/javascript'; 
resource.async = true;
var spreadsheetkey = "MY_SPREADSHEET_KEY";
var url="http://www.example.com";
resource.src = "https://docs.google.com/spreadsheet/tq?tqx=out:json&tq=select%20*%20%20where%20B%20%3D%20%27"+url+"%27&key="+spreadsheetkey+"&format=json&callback=getReply";
var script = document.getElementsByTagName('script')[0];
script.parentNode.insertBefore(resource, script);

function getReply(data){
alert(data);
}

I am not getting any alert which I supposed to. Can anybody tell me what might be the problem.

Upvotes: 0

Views: 375

Answers (1)

Zig Mandel
Zig Mandel

Reputation: 19835

For unauthenticated calls to the spreadsheet feed you need to make your spreadsheet public.

Upvotes: 1

Related Questions