为什么我会出错;gspread.exceptions.novalidurlkeyfind;关于python?
我是pyhon的新手,现在正在尝试使用google drive API 我已经为这个项目启用了GoogleSheet和GoogleDriveAPI访问。这是我的密码为什么我会出错;gspread.exceptions.novalidurlkeyfind;关于python?,python,gspread,Python,Gspread,我是pyhon的新手,现在正在尝试使用google drive API 我已经为这个项目启用了GoogleSheet和GoogleDriveAPI访问。这是我的密码 import gspread from oauth2client.service_account import ServiceAccountCredentials scope = [ 'https://spreadsheets.google.com/feeds', 'https://www.googleapis.c
import gspread
from oauth2client.service_account import ServiceAccountCredentials
scope = [
'https://spreadsheets.google.com/feeds',
'https://www.googleapis.com/auth/drive'
]
json_file_name = '/Users/kimjongyool/Desktop/upbeat-polygon-292119-fd2b4fab4fa1.json'
credentials = ServiceAccountCredentials.from_json_keyfile_name(json_file_name, scope)
gc = gspread.authorize(credentials)
spreadsheet_url = 'https://docs.google.com/spreadsheets/d/1SAci5Is4tQ1uETGKcTCUmBQrFz4C7-wmj3NhsYgKAWc/edit#gid=0'
doc = gc.open_by_url('spreadsheet_url')
如果运行此操作,将收到错误消息“gspread.exceptions.NoValidUrlKeyFound
"
我到处找,但仍然没有找到任何解决办法。请帮忙 这行代码中有一个输入错误:
doc = gc.open_by_url('spreadsheet_url')
变量名应不带引号字符(')。这是正确的版本:
doc = gc.open_by_url(spreadsheet_url)
很好,如果您对答案满意,请将其标记为已接受。