I am trying to use Google Apps Scripts batchUpdate to update the styling of a range of cells.
I have put together the very simple example to hopefully enable me to get started, however I am getting the following error message back from this.
GoogleJsonResponseException: API call to sheets.spreadsheets.values.batchUpdate failed with error: Invalid JSON payload received. Unknown name "requests": Cannot find field. at updateGoogleSheet(fullSheet/fullSheet:316)
My code to try and do the update is as follows
var data = {
requests: [{
updateCell: {
range: 'Sheet3!A3',
cell: {
userEnteredFormat: {
backgroundColor: {
red: 1
}
}
},
fields: 'userEnteredFormat(backgroundColor)'
}
}]
};
Sheets.Spreadsheets.Values.batchUpdate(data, spreadsheetId);