我的应用代表授权用户访问私人Google电子表格文档.似乎Google的API期望开发人员首先请求授权用户可用的所有电子表格文档的列表,然后才能获得特定电子表格的密钥.我想找到一个解决方法,最后通过key从URL电子表格URL中提取参数值,如下所示:
https://docs.google.com/spreadsheet/ccc?key={some long key here}&usp=drive_web#gid=0
只需简单地将字符串分解为可以key在不需要正则表达式的情况下轻松检索其值的位置.
最近,虽然我不知道最近有多少,但我注意到新创建的Google云端硬盘电子表格的网址采用以下格式:
https://docs.google.com/spreadsheets/d/{some long key here}/edit#gid=0
我也能从这个URL字符串中提取密钥,但我只是好奇两个URL之间的区别:
谢谢!
我阅读了这篇关于 Google Sheet API v4 更新的文章。我需要更改当前的代码结构吗?
我正在使用简单的 JSON 数据在网络上显示 Google 工作表数据。我使用以下代码在网络上制作了一些 PHP 和 JavaScript 基础项目:
.HTML
var sf = https://spreadsheets.google.com/feeds/list/1l7VfPOI3TYtPuBZlZ-JMMiZW1OK6rzIBt8RFd6KmwbA/1/public/values?alt=json
$.getJSON(sf, function(data) {
var sd = data.feed.entry;
key = data.feed.entry[i]['gsx$key']['$t'];
name = data.feed.entry[i]['gsx$name']['$t'];
img = data.feed.entry[i]['gsx$img']['$t'];
rice = data.feed.entry[i]['gsx$price']['$t'];
Run Code Online (Sandbox Code Playgroud)
.php
$url = 'https://spreadsheets.google.com/feeds/list/1l7VfPOI3TYtPuBZlZ-JMMiZW1OK6rzIBt8RFd6KmwbA/1/public/values?alt=json';
$file = file_get_contents($url);
$json = json_decode($file);
$rows = $json->{'feed'}->{'entry'};
$key = $row->{'gsx$key'}->{'$t'};
$price = $row->{'gsx$price'}->{'$t'};
$img = $row->{'gsx$img'}->{'$t'};
$name = $row->{'gsx$name'}->{'$t'};
Run Code Online (Sandbox Code Playgroud)
我真的需要更新任何东西吗?
javascript php google-sheets google-apps-script google-sheets-api
该Sheetsee库使用Google电子表格的数据后台。我正在尝试将我的 google 电子表格发布为 json,以便我可以使用 Sheetsee 库访问它。谷歌文档中当前可用的“发布到网络”功能没有显示任何将数据发布为 json 的选项。这是已从 Google 电子表格中删除的内容还是在 google 文档中的其他地方可用?