本文档不支持此操作

本文档不支持此操作

本文介绍了本文档不支持此操作-Sheets API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(<类'googleapiclient.errors.HttpError'> ;,当请求 https://sheets.googleapis.com/v4/spreadsheets/1IcMY2TNLYZtGyKO_zcrhP1MudNFXbNdM/values/P%C3%A1gina1%21A%3AP?alt=json 返回此文档不支持此操作",< 0x7fbb3dc3bec0>的追溯对象)

(<class 'googleapiclient.errors.HttpError'>, <HttpError 400 when requesting https://sheets.googleapis.com/v4/spreadsheets/1IcMY2TNLYZtGyKO_zcrhP1MudNFXbNdM/values/P%C3%A1gina1%21A%3AP?alt=json returned "This operation is not supported for this document">, <traceback object at 0x7fbb3dc3bec0>)

在Google表格中访问电子表格时,我收到此错误消息,我知道会发生此错误,因为它是托管在Google驱动器上,并且格式为xlsx.没有人知道在代码中直接执行从xlsx到gsheet的转换的任何替代方法吗?

I am getting this error message when accessing a spreadsheet in Google Sheets, I know that the error occurs because it is hosted on the google drive and is in xlsx format. Does anyone know any alternative to performing this conversion from xlsx to gsheet directly in the code?

推荐答案

是的,您可以将.xlsx转换为Google表格

为此,请使用方法 Drive v2方法文件:复制指定convert true.

示例:

service.files().copy(fileId=file_id,convert=true, body={"title": "specifyName"}).execute()

这篇关于本文档不支持此操作-Sheets API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 19:53