Google Drive API插入Excel文件有效,但更新没有

时间:2013-07-26 19:59:15

标签: python google-drive-api

我正在使用Google Drive API并发现我可以访问Google电子表格的元数据并以“xls”和“xlsx”格式下载。我还能够使用API​​插入(添加新的)Excel文件并将其转换为Google电子表格。但是,无论我做什么,尝试使用Excel文件更新Google电子表格时出现500次错误。这是不受支持的吗?

我正在使用python客户端库和插入和上传示例:

我有一个单独的脚本,其中auth很好,我构建一个服务就好了,上面的示例代码只是为了添加参数convert=True我可以调用:

insert_file(service, title="test", description="description", parent_id=None,
            mime_type="application/vnd.ms-excel", filename="test.xls")
  • 成功。我可以在Google云端硬盘上打开这个已经转换的新电子表格。
  • 下面的变量file_id设置为成功创建文件时在JSON中返回的file_id。我可以使用此id再次获取新文件的元数据,下载文件等

然后

update_file(service, file_id, title="modified test",
            description="modified description",
            mime_type="application/vnd.ms-excel", filename="test2.xls",
            new_revision=True)
  • 因错误500而失败

我尝试使用new_revision=False,不更改任何元数据,并在resumable=False对象创建中设置MediaFileUpload()

0 个答案:

没有答案