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

查看:59
本文介绍了如何在Google Apps脚本中获取发布到网络电子表格的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,该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从网络发布的电子表格中检索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.您可以使用两个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.

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

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