I want to read data in google spreadsheet using python.
I have a spreadsheet link.
I don't want to using oauth2client. Because only read what I want to. not write.
Is there a way I can do?
from oauth2client.client import SignedJwtAssertionCredentials
def authenticate_and_get_spreadsheet():
scope = ['https://spreadsheets.google.com/feeds']
client_email = get_client_email() # something that looks like 962835581947-l1r8s2brhu5sjfljkg7ve54fcfxuio2b@developer.gserviceaccount.com
private_key = get_private_key()
credentials = SignedJwtAssertionCredentials(client_email, private_key, scope)
gc = gspread.authorize(credentials)
return gc
def get_spreadsheet():
gc = authenticate_and_get_spreadsheet()
ss = gc.open_by_key('1FxDkjsdhffQOPC-f93Cccebkjasd5NMzl4AahDk') # document key
return ss # now you can read/write this spreadsheet
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.