0

googlesheet에서 작동하려면 oauth2client 및 gspread를 사용하려고했지만 문제는 oauth2client를 사용할 때 범위 필드가 필요하다는 것입니다. 범위가 무엇인지 전혀 알지 못합니다. 다음은 oauth2client 사용 코드입니다.gspread 및 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 
+0

스프레드 시트를 열 수 있습니까? 아니면 범위가 무엇인지 궁금하십니까? – Burnash

+0

@Burnash 범위를 알아 냈지만 open_with_url을 사용하여 직접 내 스프레드 시트의 URL을 복사하고 코드를 찾을 때 스프레드 시트를 찾을 수 없음을 보여줍니다. 내가 만든 스프레드 시트는 Google 프로젝트 (또는 API는 무엇을 호출했는지 잊어 버린 것을 잊어 버렸습니다.)를 작성한 동일한 계정에서 생성했습니다. – Edccccch

+0

gspread-april-2cd의 스프레드 시트를 'client_email'과 공유 했습니까? ba4.json – Burnash

답변

0

OAuth 범위는 사용자가 앱에 대한 권한을 요청한 권한을 나타냅니다.

Google Sheets API v3을 사용할 때 요청한 권한을 사용할 수있는 유일한 범위입니다.

https://spreadsheets.google.com/feeds 

당신이 Google Sheets API v4를 사용하는 경우, 당신은 지금이 두 범위 중 하나를 사용할 수 있지만 : 사용자의 시트와 그 속성에 대한 읽기 전용 액세스 및

https://www.googleapis.com/auth/spreadsheets 
수 있습니다

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

사용자의 시트 및 속성에 대한 읽기/쓰기 액세스를 허용합니다.