Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/327.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 使用Google Sheets API将Google Sheet文档发布到web_Python_Google Api_Google Spreadsheet Api_Google Python Api - Fatal编程技术网

Python 使用Google Sheets API将Google Sheet文档发布到web

Python 使用Google Sheets API将Google Sheet文档发布到web,python,google-api,google-spreadsheet-api,google-python-api,Python,Google Api,Google Spreadsheet Api,Google Python Api,我的目标是将GoogleSheet文档发布到web上,并使用GoogleSheetsAPI获取链接 我设法使用发布,现在在文件->发布到web选项卡中显示“已发布”。但是,此选项卡上提供的链接与原始的文件id不同,我不知道如何使用API获取它。不幸的是,https://docs.google.com/spreadsheets/d/e/### 无法直接检索电子表格发布时检索到的非fileId####/pubhtml。在Drive API v2上,修订版中有publishedLink作为字段。但我确

我的目标是将GoogleSheet文档发布到web上,并使用GoogleSheetsAPI获取链接


我设法使用发布,现在在文件->发布到web选项卡中显示“已发布”。但是,此选项卡上提供的链接与原始的
文件id不同,我不知道如何使用API获取它。

不幸的是,
https://docs.google.com/spreadsheets/d/e/### 无法直接检索电子表格发布时检索到的非fileId####/pubhtml
。在Drive API v2上,修订版中有
publishedLink
作为字段。但我确认它现在不能使用<代码>发布链接
已通过将驱动器API从v2更新为v3删除。这可能会影响局势。但我对此不确定

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

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

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

你不能处理已发布的文件。只需公开共享,这样您仍然可以在其上操作REST API。@Vasily我的答案对您有用吗?如果你对我的答案还有疑问,尽管告诉我。这些信息帮助我学习。另外,我认为这有助于其他用户了解情况,作为一种信息。我非常感谢您的帮助。您的答案是正确的,但我实际上使用了同样适用于我的示例:
https://docs.google.com/spreadsheets/d/[sheet_id]/pubhtml
@Vasily感谢您提供的更多信息。我可以从你的问题中学习。也谢谢你。