使用JSONP选择工作表

使用JSONP选择工作表

本文介绍了Google Spreadsheet-使用JSONP选择工作表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

第一个端点

我正在阅读 Google查询语言规范.该端点允许我查询数据,但是我还没有弄清楚如何选择页面,如何选择页面?我试过了:

$.ajax({
  dataType: 'jsonp',
  url: 'http://spreadsheets.google.com/a/google.com/tq?key=ABCDE&tq=select%mypage!A'
})

请注意mypage!.但这是行不通的.

此外,当尝试不使用mypage!时,我会收到这样的答案:

// Data table response
google.visualization.Query.setResponse({"version":"0.6...

我应该从哪里了解有关此回复的信息?我需要加载一些Google图书馆吗?为什么,如果我只想要数据?有没有更好的方法来获取数据?

第二个端点

我还阅读了示例.这允许选择代码为od6od7等的工作表,为什么它以od6开头?仅仅是我的文档吗?在这里可以找到有关此文档的文档.

对于两个端点,我都使用JSONP.

解决方案

使用 gid = 例如:

我读到#gid和od6没有连接,而获取链接到#gid的od6的唯一方法是遍历所有#gid值以找到匹配的表.

我怀疑无法将"gid"添加到查询字符串中,因为无法将来自多个源的数据与查询合并,或者无法合并.

First endpoint

I am reading Google query language specification. This endpoint allows me to query data but I have not figured out how to select page, how can I select page? I tried:

$.ajax({
  dataType: 'jsonp',
  url: 'http://spreadsheets.google.com/a/google.com/tq?key=ABCDE&tq=select%mypage!A'
})

Note the mypage!. But this does not work.

Also, when trying without mypage!, I receive an answer like this:

// Data table response
google.visualization.Query.setResponse({"version":"0.6...

Where should I read about this response? do I need to load some Google Library? why, if I just want the data? is there a better approach to get just data?

Second endpoint

I also read this example. This allows to select worksheet with a code od6, od7 and so on, why it starts in od6?, is just my document? where I can find documentation about this.

For both endpoints I am using JSONP.

解决方案

Use gid= e.g :

https://spreadsheets.google.com/tq?key=0Ao_WaOWBqWmjdGRZV3dxdW1sdXhaeUs0cko5ZEVldEE&gid=0&tq=select%20A

I read that #gid and od6 are not connected, and the only way to get the od6 that links to the #gid, is to loop through all the #gid values to find the matching sheet.

I suspect there is no way to add "gid" into the query string, as there is no way to merge data from more than one source with the query, or none that I have seen.

这篇关于Google Spreadsheet-使用JSONP选择工作表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 12:14