Sunday, February 23, 2020

using python gspread to read google sheets

https://github.com/burnash/gspread

#!/usr/bin/python# -*- coding: utf-8 -*-import gspread
from oauth2client.service_account import ServiceAccountCredentials
# use creds to create a client to interact with the Google Drive APIscope = ['https://spreadsheets.google.com/feeds']
creds = ServiceAccountCredentials.from_json_keyfile_name('key.json', scope)
client = gspread.authorize(creds)
gss = client.open_by_url("url of sheet")

#list_of_hashes = sheet.get_all_records()#print(len(list_of_hashes))#print(list_of_hashes)

No comments:

Post a Comment