这是使用 Google Drive 创建的公共(public)电子表格:
https://docs.google.com/spreadsheets/d/1hA4LKZn9yKoqnSzaI6_73GQSj_ZVpB3O0kC93QM98Vs/pubhtml
如何使用新的 Google Spreadsheets API version 3.0 将数据从 Google 电子表格检索到 Javascript 或 JSON ?
最佳答案
您可以访问 cell-based basic feed使用以下 URL 结构:https://spreadsheets.google.com/feeds/cells/1hA4LKZn9yKoqnSzaI6_73GQSj_ZVpB3O0kC93QM98Vs/od6/public/basic?alt=json .默认情况下,提要采用 XML 格式,但是,您可以使用 alt=json 查询参数请求 JSON 格式。
此提要还支持 JSONP 请求,因此使用 jQuery 从浏览器获取此数据的示例可能如下所示:
var url = "https://spreadsheets.google.com/feeds/cells/1hA4LKZn9yKoqnSzaI6_73GQSj_ZVpB3O0kC93QM98Vs/od6/public/basic?alt=json";
$.ajax({
url:url,
dataType:"jsonp",
success:function(data) {
// data.feed.entry is an array of objects that represent each cell
},
});
关于javascript - 如何将数据从 Google 电子表格检索到 Javascript 或 JSON?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23760768/