The code below works. The problem I am encountering is an invisible '
appears in the google sheet before all values in the first column 'problem
'.
I have attempted to change the formatting on the google sheet as described in other resources, but changing this string of ints to a number doesn't work.
I believe the issue is formatting while passing the values to Sheets, but there is nothing in the gspread docs that explain how to fix this.
import gspread
import pandas as pd
data=[['1, 2', 'hello', 4], ['3, 4', 'there', 3]]
cols = ['problem', 'words', 'ints']
df = pd.DataFrame(data=data, columns=cols)
df_as_lists = df.values.tolist()
svc_acct = gspread.service_account_from_dict(info=gs_key)
sheet = svc_acct.open_by_url('https://docs.google.com/spreadsheets/d/1cW1ry2FwlEOGSF270skXLN52UeqWkhgFXfeDVqH_a3M/edit#gid=0')
wks = sheet.worksheet('Sheet1')
wks.update('A1:C3', df_as_lists)
Current values in Sheets:
lists words ints
0 '1, 2 hello 4
1 '3, 4 there 3
Desired values in Sheets:
lists words ints
0 1, 2 hello 4
1 3, 4 there 3