How to fix the "google.auth.exceptions.RefreshError: ('No access token in response." when trying to open a spreadsheet using GoogleSheet API
How to fix the "google.auth.exceptions.RefreshError: ('No access token in response." when trying to open a spreadsheet using GoogleSheet API
我跟着 TechWithTim 的视频一步一步 (https://www.youtube.com/watch?v=cnPlKLEGR7E)
但是当我尝试打开 sheet 时仍然出现错误。
该代码在 sheet = client.open("GuildTaxes").sheet1
行之前工作正常。
这是我的代码。
import gspread
from oauth2client.service_account import ServiceAccountCredentials
scope = ["https://spreadsheets.google.com/feeds","https://www.googleapis.com/auth/sprea...",
"https://www.googleapis.com/auth/drive...","https://www.googleapis.com/auth/drive"]
creds = ServiceAccountCredentials.from_json_keyfile_name("GuildTaxes-9ba4508be840.json", scope)
client = gspread.authorize(creds)
sheet = client.open("GuildTaxes").sheet1
data = sheet.get_all_records()
print(data)
我找到了答案!2 小时后,TechWithTim 视频中的示波器对我不起作用,所以如果你遇到同样的问题,请尝试使用这个
scope = [
'https://www.googleapis.com/auth/spreadsheets',
'https://www.googleapis.com/auth/drive'
]
这是默认范围。
我跟着 TechWithTim 的视频一步一步 (https://www.youtube.com/watch?v=cnPlKLEGR7E)
但是当我尝试打开 sheet 时仍然出现错误。
该代码在 sheet = client.open("GuildTaxes").sheet1
行之前工作正常。
这是我的代码。
import gspread
from oauth2client.service_account import ServiceAccountCredentials
scope = ["https://spreadsheets.google.com/feeds","https://www.googleapis.com/auth/sprea...",
"https://www.googleapis.com/auth/drive...","https://www.googleapis.com/auth/drive"]
creds = ServiceAccountCredentials.from_json_keyfile_name("GuildTaxes-9ba4508be840.json", scope)
client = gspread.authorize(creds)
sheet = client.open("GuildTaxes").sheet1
data = sheet.get_all_records()
print(data)
我找到了答案!2 小时后,TechWithTim 视频中的示波器对我不起作用,所以如果你遇到同样的问题,请尝试使用这个
scope = [
'https://www.googleapis.com/auth/spreadsheets',
'https://www.googleapis.com/auth/drive'
]
这是默认范围。