Append a list in Google Sheet from Python
How about this sample script? This sample appends list
to column A. The list as data is 2 dimensional array. Please be careful for this. In order to use this script, please enable Sheet API v4 at API console.
Sample script :
credentials = GoogleCredentials.get_application_default()
service = build('sheets', 'v4', credentials=credentials)
list = [["valuea1"], ["valuea2"], ["valuea3"]]
resource = {
"majorDimension": "ROWS",
"values": list
}
spreadsheetId = "### spreadsheet ID"
range = "Sheet1!A:A";
service.spreadsheets().values().append(
spreadsheetId=spreadsheetId,
range=range,
body=resource,
valueInputOption="USER_ENTERED"
).execute()
You can see the detail information of spreadsheets.values.append at here.
If this sample was not useful for you, I'm sorry.