Python Gspread - gspread.exceptions.APIError,代码:400

时间:2018-06-07 14:32:17

标签: python-3.x google-spreadsheet-api gspread

我一直在努力学习如何使用Google表格和Python,但是当我运行我的代码时,我收到了这个错误。 (我使用的是Python 3.6.5。)

代码:

import gspread
from oauth2client.service_account import ServiceAccountCredentials

scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive']
creds = ServiceAccountCredentials.from_json_keyfile_name('client_secret.json', scope)
client = gspread.authorize(creds)

sheet = client.open("pythontest").sheet1

pythontest = sheet.get_all_records()
print(pythontest)

错误:

Traceback (most recent call last):
  File "C:\Users\TimGF\Documents\Coding\Python\Google Sheet Keylogger\spreadsheet.py", line 10, in <module>
    pythontest = sheet.get_all_records()
  File "C:\Python36\lib\site-packages\gspread\models.py", line 470, in get_all_records
    data = self.get_all_values()
  File "C:\Python36\lib\site-packages\gspread\models.py", line 444, in get_all_values
    data = self.spreadsheet.values_get(self.title)
  File "C:\Python36\lib\site-packages\gspread\models.py", line 110, in values_get
    r = self.client.request('get', url, params=params)
  File "C:\Python36\lib\site-packages\gspread\client.py", line 79, in request
    raise APIError(response)
gspread.exceptions.APIError: {
  "error": {
    "code": 400,
    "message": "Range ('Ark1'!ARK1) exceeds grid limits. Max rows: 57, max columns: 2",
    "status": "INVALID_ARGUMENT"
  }
}

我不是一个非常有经验的python用户,但如果您想了解更多信息,请随时发表评论。

由于

0 个答案:

没有答案