【问题标题】:How to fix the error <HttpError 404 "Requested entity was not found.">如何修复错误 <HttpError 404 "Requested entity was not found.">
【发布时间】:2019-04-24 04:43:49
【问题描述】:

通过python将数据插入谷歌表后,我想尝试清除谷歌表中的这些数据并出现错误

<HttpError 404 when requesting https://sheets.googleapis.com/v4/spreadsheets/Master/values/Master%21A3%3AZ:clear?alt=json returned "Requested entity was not found.">

我不知道发生了什么,因为我按照快速入门 python 页面 https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/clear 的说明进行操作

这是我目前得到的代码

def remove():
    service=get_service()

    sheet_name = 'Master'
    range_values = sheet_name + '!A3:Z'

    clear_values_request_body = {
    # TODO: Add desired entries to the request body.
    }

    request = service.spreadsheets().values().clear(spreadsheetId=sheet_name, range=range_values, body=clear_values_request_body)
    response = request.execute()

    print(response)

我无法检测到错误,是我做错了吗?

【问题讨论】:

  • 我犯了同样愚蠢的错误——在我的例子中,我将它包装在一个函数中并继续以spreadsheetId 发送查询。看来您也使用了错误的 spreadsheetId - NOT 应该是 sheet_name

标签: python google-sheets http-error


【解决方案1】:

您应该改用对您有极大帮助的库。我是 Python Sheetfu (https://github.com/socialpoint-labs/sheetfu) 的作者。

您还应该查看其他库,例如 gspread 和 pygsheet 来命名它们,这会有所帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-02-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-11
    • 1970-01-01
    • 1970-01-01
    • 2013-08-15
    相关资源
    最近更新 更多