为什么 Google 电子表格文档有两种不同的 URL 格式? [英] Why are there two different URL formats for Google spreadsheet documents?

查看:29
本文介绍了为什么 Google 电子表格文档有两种不同的 URL 格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用代表授权用户访问私人 Google 电子表格文档.似乎 Google 的 API 要求开发人员首先请求授权用户可用的所有电子表格文档的列表,然后他们才能获得特定电子表格的密钥.我想找到一个解决方法,最终通过从 URL 电子表格 URL 中提取 key 参数值来解决这个问题:

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={这里有一些长键}&usp=drive_web#gid=0

很简单,只需将字符串分解为指向我可以相当容易地检索 key 的值,而无需正则表达式.

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.

最近,虽然我不知道最近多久,但我注意到新创建的 Google 云端硬盘电子表格的网址采用以下形式:

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/{这里有一些长键}/edit#gid=0

我也能够从这个 URL 字符串中提取密钥,但我只是好奇这两个 URL 之间的区别:

I was also able to extract the key from this URL string, but am just curious about the difference between the two URLs:

  1. 这两个 URL 之间的意义是什么.
  2. 为什么 Google 的 API 会强制开发人员首先获取所有可用文档的列表,而开发人员可能只想从指向 Google 云端硬盘电子表格文档的直接 URL 中提取密钥.

谢谢!

推荐答案

旧样式表

他们只能在线工作,每个电子表格最多只能包含 400,000 个单元格.

Old style sheets

They work online only and limited to about 400,000 cells per spreadsheet.

旧式网址

 https://docs.google.com/spreadsheet/ccc?key={some long key here}&usp=drive_web#gid=0

新样式表

大约在 2013 年 12 月中旬发布

New style sheets

Released about mid Dec 2013

离线工作,(如果我记得的话)每个电子表格最多可处理 2,000,000 个单元格.

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

电子表格密钥

我使用 Google-apps-script 获取密钥,如下所述:获取位于网址.不是 ss.getId()

这篇关于为什么 Google 电子表格文档有两种不同的 URL 格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆