[英]How to get the id for a published to the web spreadsheet in google apps scripts
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. 然后,脚本将它们发布到Web。
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,该ID将允许我获取其Web版本的URL。
A regular spreadsheet id looks like this: 常规电子表格ID如下所示:
1N8h00iN2L7aaUbI9TYRWioaZHjHNSc_vNucCbVADj1o 1N8h00iN2L7aaUbI9TYRWioaZHjHNSc_vNucCbVADj1o
And a published to the web id looks like this: 发布到网络的ID如下所示:
2PACX-1vTPSkv4Rz7CqwabTTfxa3xcVF-Gzxu7IboLyLkfoShP2d3qdX8o0qdvk5d_nWZD2rq43E2LXmVAm5HI 2PACX-1vTPSkv4Rz7CqwabTTfxa3xcVF-Gzxu7IboLyLkfoShP2d3qdX8o0qdvk5d_nWZD2rq43E2LXmVAm5HI
(longer, and it starts with 2PACX-) (更长,它以2PACX-开头)
Anybody know how to? 有人知道怎么做吗?
Thanks in advance. 提前致谢。
You want to retrieve URL from the web published spreadsheet using file ID. 您要使用文件ID从网络发布的电子表格中检索URL。 If my understanding is correct, how about this answer? 如果我的理解是正确的,那么这个答案呢? Unfortunately, "publishedLink" cannot be retrieved by Drive API v3. 不幸的是,Drive API v3无法检索“ publishedLink”。 "publishedLink" got to not be able to be used from Drive API v3. 必须从Drive API v3中不能使用“ publishedLink”。 Furthermore now, Drive API v2 also cannot be used anymore. 此外,现在也无法再使用Drive API v2。 So it is required to create the link manually. 因此,需要手动创建链接。
When the spreadsheet is published to Web, you retrieve URL like as follows. 当电子表格发布到Web时,您将检索URL,如下所示。
https://docs.google.com/spreadsheets/d/e/2PACX-1vTPSkv4Rz7CqwabTTfxa3xcVF-Gzxu7IboLyLkfoShP2d3qdX8o0qdvk5d_nWZD2rq43E2LXmVAm5HI/pubhtml
When you want to use the URL using file ID, please use the following URL. 当您想通过文件ID使用URL时,请使用以下URL。 You can use both URLs. 您可以使用两个URL。
https://docs.google.com/spreadsheet/pub?key=### fileId ###
https://docs.google.com/spreadsheets/d/### fileId ###/pubhtml
If I misunderstand your question, I'm sorry. 如果我误解了您的问题,对不起。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.