How to get the id for a published to the web sprea

2019-03-04 10:30发布

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.

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

A regular spreadsheet id looks like this:

1N8h00iN2L7aaUbI9TYRWioaZHjHNSc_vNucCbVADj1o

And a published to the web id looks like this:

2PACX-1vTPSkv4Rz7CqwabTTfxa3xcVF-Gzxu7IboLyLkfoShP2d3qdX8o0qdvk5d_nWZD2rq43E2LXmVAm5HI

(longer, and it starts with 2PACX-)

Anybody know how to?

Thanks in advance.

1条回答
看我几分像从前
2楼-- · 2019-03-04 11:02

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.

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

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

Pattern 1:

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

Pattern 2:

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

If I misunderstand your question, I'm sorry.

查看更多
登录 后发表回答