Created
September 29, 2020 14:11
-
-
Save merltron-pa/7a37917dbb23e650dbb0605713a5784d to your computer and use it in GitHub Desktop.
multitouch_article_pt1
This file contains 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 the json file with the google credentials | |
with open("google_credentials.json", "r") as f: | |
google_credentials = json.load(f) | |
#load the credentials in the right variable | |
scope = ['https://www.googleapis.com/auth/cloud-platform', 'https://spreadsheets.google.com/feeds'] | |
credentials_gs = ServiceAccountCredentials.from_json_keyfile_dict(google_credentials, scope) | |
gc = gspread.authorize(credentials_gs) | |
#pull data from the right google spreadsheet and insert it into a dataframe | |
spreadsheet_key = 'YOUR_SPREADSHEET_KEY' | |
book = gc.open_by_key(spreadsheet_key) | |
worksheet = book.worksheet("GA raw data") | |
table = worksheet.get_all_values() | |
ga_raw_data = pd.DataFrame(table[1:], columns=table[0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment