Python 3.x gspread使用python 3读取google工作表文件
我正在使用运行Pycharm的Python3和模块gspread来读取我的google驱动器中的google工作表文件。好的,我已经完成了所有关于如何读取文件的步骤。不幸的是,我下面的代码还不能工作Python 3.x gspread使用python 3读取google工作表文件,python-3.x,pycharm,google-api-client,gspread,Python 3.x,Pycharm,Google Api Client,Gspread,我正在使用运行Pycharm的Python3和模块gspread来读取我的google驱动器中的google工作表文件。好的,我已经完成了所有关于如何读取文件的步骤。不幸的是,我下面的代码还不能工作 import gspread from oauth2client.service_account import ServiceAccountCredentials scope =['https://docs.google.com/spreadsheets/d/1xnaOZMd2v93tY2
import gspread
from oauth2client.service_account import ServiceAccountCredentials
scope =['https://docs.google.com/spreadsheets/d/1xnaOZMd2v93tY28h_hsuMnZYXC9YqCfFpQX70lwpN94/edit?usp=sharing']
credentials = ServiceAccountCredentials.from_json_keyfile_name('distech-c1e26e7150b2.json',scope)
gc = gspread.authorize(credentials)
wks = gc.open("POC").sheet1
for temp in wks:
print(temp)
我如何使用这个模块来读取google工作表文件?非常感谢经过深入研究,我发现了两件事
scope=['https://spreadsheets.google.com/feeds']
client\u email:“278348728734832”-compute@developer.gserviceaccount.com
import gspread
from oauth2client.service_account import ServiceAccountCredentials
scope =['https://spreadsheets.google.com/feeds']
credentials = ServiceAccountCredentials.from_json_keyfile_name('xxx.json',scope)
gc = gspread.authorize(credentials)
spreadsheet = gc.open("POC")
wks = spreadsheet.worksheet('test1')
wks2 = spreadsheet.worksheet('test2')
out = list()
out = wks.col_values(1)
for temp in out:
print(out)