1import pygsheets
2import pandas as pd
3#authorization
4gc = pygsheets.authorize(service_file='/Users/erikrood/desktop/QS_Model/creds.json')
5
6# Create empty dataframe
7df = pd.DataFrame()
8
9# Create a column
10df['name'] = ['John', 'Steve', 'Sarah']
11
12#open the google spreadsheet (where 'PY to Gsheet Test' is the name of my sheet)
13sh = gc.open('PY to Gsheet Test')
14
15#select the first sheet
16wks = sh[0]
17
18#update the first sheet with df, starting at cell B2.
19wks.set_dataframe(df,(1,1))
20