Advertisement
Guest User

Untitled

a guest
Oct 1st, 2019
396
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 KB | None | 0 0
  1. import gspread
  2. from oauth2client.service_account import ServiceAccountCredentials
  3.  
  4. info = {
  5.         "type": "service_account",
  6.         "project_id": "PROJECTID",
  7.         "private_key_id": "key",
  8.         "private_key": "key",
  9.         "client_email": "email",
  10.         "client_id": "id",
  11.         "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  12.         "token_uri": "https://oauth2.googleapis.com/token",
  13.         "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  14.         "client_x509_cert_url": "url"
  15.     }
  16. scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive']
  17. creds = ServiceAccountCredentials.from_json_keyfile_dict(info, scope)
  18. clients = gspread.authorize(creds)
  19. wks = clients.open('GOOGLE_SHEET')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement