latest_from_arxiv / gsheet_test.py
ryanrwatkins's picture
Create gsheet_test.py
8dcf2ca verified
raw
history blame contribute delete
602 Bytes
import pygsheets
import pandas as pd
import os
#authorization
authorization = os.environ.get("Google_cred")
gc = pygsheets.authorize(service_account_env_var = authorization)
#gc = pygsheets.authorize(service_file='/Users/erikrood/desktop/QS_Model/creds.json')
# Create empty dataframe
df = pd.DataFrame()
# Create a column
df['name'] = ['John', 'Steve', 'Sarah']
#open the google spreadsheet (where 'PY to Gsheet Test' is the name of my sheet)
sh = gc.open('PY to Gsheet Test')
#select the first sheet
wks = sh[0]
#update the first sheet with df, starting at cell B2.
wks.set_dataframe(df,(1,1))