使用Google Sheets API将Google Sheet文档发布到网络上 [英] Publish Google Sheet document to the web using Google Sheets API

查看:508
本文介绍了使用Google Sheets API将Google Sheet文档发布到网络上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的目标是将Google表格文档发布到网络上,并使用Google表格API获取链接.

My goal is to publish a Google Sheet document to the web and get the link using Google Sheets API.

我设法使用此建议将其发布,现在它在文件"->发布到网络"中显示为已发布"标签.但是,此选项卡上提供的链接与原始file id不同,我不知道如何使用API​​来获取它.

I managed to publish it using this advice and now it says "published" in File -> Publish to the web tab. However, the link given on this tab is different from the original file id, and I don'k know how to get it with API.

推荐答案

不幸的是,发布电子表格时检索到的https://docs.google.com/spreadsheets/d/e/### Not fileId ###/pubhtml的URL无法直接检索.在Drive API v2中,修订"字段中有publishedLink.但是我确认它现在不能使用.通过将Drive API从v2更新到v3,删除了publishedLink.这可能会影响情况.但是我不确定.

Unfortunately, the URL of https://docs.google.com/spreadsheets/d/e/### Not fileId ###/pubhtml retrieved when the spreadsheet is published cannot be directly retrieved. At Drive API v2, there was publishedLink in Revision as a field. But I confirmed that it cannot be used now. publishedLink was removed by updating Drive API from v2 to v3. This might affect to the situation. But I'm not sure about this.

那如何使用以下URL作为解决方法呢?在这种情况下,您可以使用文件ID访问已发布的电子表格.

So how about using the following URL as a workaround? In this case, you can access the published spreadsheet using file ID.

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

参考:

  • 迁移到Google Drive API v3
  • Reference :

    • Migrate to Google Drive API v3
    • 如果我误解了你的问题,对不起.

      If I misunderstand your question, I'm sorry.

      这篇关于使用Google Sheets API将Google Sheet文档发布到网络上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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