I\'m developing a Python 2.7 script that analyzes data from an SQL table and at the end, generates a CSV file.
Once the file is gener
An alternative to Sam Berlin's answer, you can turn your CSV into a list of lists and set that to your POST payload.
Such a function looks something like this:
def preprocess(table):
table.to_csv('pivoted.csv') # I use Pandas but use whatever you'd like
_file = open('pivoted.csv')
contents = _file.read()
array = contents.split('\n')
master_array = []
for row in array:
master_array.append(row.split(','))
return master_array
That master array gets thrown into the following:
body = {
'values': newValues
}
result2 = service.spreadsheets().values().update(spreadsheetId=spreadsheetId, range=rangeName + str(len(values) + start + 1), valueInputOption="USER_ENTERED", body=body).execute()
It works just fine for me.