为什么Google电子表格文档有两种不同的网址格式? [英] Why are there two different URL formats for Google spreadsheet documents?
问题描述
我的应用程序代表授权用户访问私人Google电子表格文档。 Google的API似乎期望开发人员在获得特定电子表格的密钥之前,首先向授权用户请求所有可用的电子表格文档列表。我想找到一个解决方法,最终通过从URLs电子表格URL中提取键
参数值,如下所示:
https://docs.google.com/spreadsheet/ccc?key= {some long key here}& usp = drive_web#gid = 0
只要将字符串分解到指定位置,我就可以非常简单地检索 key
的值需要一个正则表达式。
最近,尽管我不知道最近的情况,但我注意到新创建的Google Drive电子表格的URL以这种形式出现:
https://docs.google.com/spreadsheets/d/ {some long key here} / edit#gid = 0
我也可以从这个URL字符串中提取密钥,但我只是对这两个URL之间的区别感到好奇:
- 这两个网址之间有什么重要性。
- 为什么Google的API部门会首先获取所有可用文档的列表, ev可能只想从直接链接中提取密钥到Google Drive电子表格文档。 $ b
- What is the significance between the two URLs.
- Why does Google's API force devs to first get a list of all available docs, when a dev might just want to extract a key from a direct URL to a Google Drive spreadsheet doc.
旧样式表
只能在线工作,并且每个电子表格仅限于约400,000个单元格。
旧式网址
https://docs.google。 com / spreadsheet / ccc?key = {some long key here}& usp = drive_web#gid = 0
< h2>新样式表
2013年12月中旬发布
可离线使用(如果我记得)每个电子表格有2,000,000个单元格。
https://docs.google.com/spreadsheets/d/ {某些长键在这里} /编辑#gid = 0
电子表格KEY
我使用Google-apps-script获得密钥,如下所述:
获取电子表格密钥在URL中。不是ss.getId()
My app accesses private Google spreadsheet documents on behalf of an authorized user. It seems that Google's API expects developers to first request a list of all the spreadsheet documents available to an authorized user before they can get at a particular spreadsheet's keys. I wanted to find a workaround to this, and eventually did by extracting the key
parameter value from URLs spreadsheet URLs that look like this:
https://docs.google.com/spreadsheet/ccc?key={some long key here}&usp=drive_web#gid=0
It was simple enough to just break down the string to point where I could retrieve key
's value fairly easy without the need of a regex.
Recently, though I don't know how recent, I notice URLs to newly created Google Drive spreadsheets come in this form:
https://docs.google.com/spreadsheets/d/{some long key here}/edit#gid=0
I was also able to extract the key from this URL string, but am just curious about the difference between the two URLs:
Thanks!
Old style sheets
They work online only and limited to about 400,000 cells per spreadsheet.
Old style URL
https://docs.google.com/spreadsheet/ccc?key={some long key here}&usp=drive_web#gid=0
New style sheets
Released about mid Dec 2013
Works offline and (if I remember) up to 2,000,000 cells per spreadsheet.
https://docs.google.com/spreadsheets/d/{some long key here}/edit#gid=0
Spreadsheet KEY
I get the key using Google-apps-script, as described here: Get the spreadsheet key that is in the URL. Not ss.getId()
这篇关于为什么Google电子表格文档有两种不同的网址格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!