我正在尝试使用 gspread 库从 Colaboratory 访问电子表格,但出现属性错误
module 'gspread' has no attribute 'service_account'
我的代码是这样的:
import gspread as gs
import pandas as pd
gc = gs.service_account(filename='[link_to_the_service_account_json_file]')
sh = gc.open_by_url('[link_to_the_sheet]')
ws = sh.worksheet('[sheetname]')
df = pd.DataFrame(ws.get_all_records())
df.head()
我做错了什么?
service_account()
是在 3.6 版本中添加的,我使用的是 3.4.2