0

我试图使用 oauth2client 和 gspread 在 googlesheet 上进行操作,但我遇到的问题是,当使用 oauth2client 时,它需要一个范围字段。我不知道范围是什么。下面是oauth2client的使用代码。

import gspread
from oauth2client.service_account import ServiceAccountCredentials

scope = ['https://spreadsheets.google.com/feeds']

credentials = ServiceAccountCredentials.from_json_keyfile_name('gspread-april-2cd … ba4.json', scope)

gc = gspread.authorize(credentials)

wks = gc.open("Where is the money Lebowski?").sheet1
4

1 回答 1

0

OAuth 范围表示您请求用户为您的应用授权的权限。

您使用的范围是在使用Google Sheets API v3时授权您的请求的唯一可用范围。

https://spreadsheets.google.com/feeds

如果您使用的是Google Sheets API v4,您现在可以使用以下两个范围中的任何一个:

https://www.googleapis.com/auth/spreadsheets.readonly

允许只读访问用户的工作表及其属性和

https://www.googleapis.com/auth/spreadsheets

允许对用户的工作表及其属性进行读/写访问。

于 2016-07-14T13:04:19.200 回答