Created
July 27, 2019 05:55
-
-
Save lowweihong/555f62c0dba3d4844fc921b732b28ef4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gspread | |
from oauth2client.service_account import ServiceAccountCredentials | |
import pandas as pd | |
import requests | |
from bs4 import BeautifulSoup | |
# Access credentials for google sheet and access the google sheet | |
scope = ['https://spreadsheets.google.com/feeds', | |
'https://www.googleapis.com/auth/drive'] | |
# Copy your path to your credential JSON file. | |
PATH_TO_CREDENTIAL = '/Users/bla/credential/data science-4936da0d6b1f.json' | |
# Initiate your credential | |
credentials = ServiceAccountCredentials.from_json_keyfile_name(PATH_TO_CREDENTIAL, scope) | |
# Authorize your connection to your google sheet | |
gc = gspread.authorize(credentials) | |
# Access google sheet | |
sht1 = gc.open_by_key('11DU3qbPoXlbUXJ-o_zerndJdqQ8pNBMsAZpeBfbwyc0') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment