如何在谷歌应用程序脚本中获取发布到网络电子表格的 ID [英] How to get the id for a published to the web spreadsheet in google apps scripts

查看:20
本文介绍了如何在谷歌应用程序脚本中获取发布到网络电子表格的 ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个脚本,可以从电子表格中获取行,并为每一行创建单独的电子表格文件.然后脚本将它们发布到网络上.

I have a script that takes rows from a spreadsheet, and creates individual spreadsheet files for each row. Then the script publishes them to the web.

我无法获得的是允许我获得它的网络版本网址的 ID.

What I'm not able to get is the id that will allow me to get an url for a web version of it.

常规电子表格 ID 如下所示:

A regular spreadsheet id looks like this:

1N8h00iN2L7aaUbI9TYRWioaZHjHNSc_vNucCbVADj1o

1N8h00iN2L7aaUbI9TYRWioaZHjHNSc_vNucCbVADj1o

发布到网络的 id 如下所示:

And a published to the web id looks like this:

2PACX-1vTPSkv4Rz7CqwabTTfxa3xcVF-Gzxu7IboLyLkfoShP2d3qdX8o0qdvk5d_nWZD2rq43E2LXmVAm5HI

2PACX-1vTPSkv4Rz7CqwabTTfxa3xcVF-Gzxu7IboLyLkfoShP2d3qdX8o0qdvk5d_nWZD2rq43E2LXmVAm5HI

(更长,以 2PACX- 开头)

(longer, and it starts with 2PACX-)

有人知道怎么做吗?

提前致谢.

推荐答案

您想使用文件 ID 从 Web 发布的电子表格中检索 URL.如果我的理解是正确的,这个答案怎么样?不幸的是,Drive API v3 无法检索publishedLink"."publishedLink" 无法从 Drive API v3 使用.此外,现在 Drive API v2 也不能再使用了.所以需要手动创建链接.

You want to retrieve URL from the web published spreadsheet using file ID. If my understanding is correct, how about this answer? Unfortunately, "publishedLink" cannot be retrieved by Drive API v3. "publishedLink" got to not be able to be used from Drive API v3. Furthermore now, Drive API v2 also cannot be used anymore. So it is required to create the link manually.

当电子表格发布到 Web 时,您可以按如下方式检索 URL.

When the spreadsheet is published to Web, you retrieve URL like as follows.

https://docs.google.com/spreadsheets/d/e/2PACX-1vTPSkv4Rz7CqwabTTfxa3xcVF-Gzxu7IboLyLkfoShP2d3qdX8o0qdvk5d_nWZD2rq43E2LXmVAm5HI/pubhtml

当您想使用使用文件 ID 的 URL 时,请使用以下 URL.您可以使用这两个网址.

When you want to use the URL using file ID, please use the following URL. You can use both URLs.

https://docs.google.com/spreadsheet/pub?key=### fileId ###

模式 2:

https://docs.google.com/spreadsheets/d/### fileId ###/pubhtml

如果我误解了你的问题,我很抱歉.

If I misunderstand your question, I'm sorry.

这篇关于如何在谷歌应用程序脚本中获取发布到网络电子表格的 ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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