Reputation: 11
I am trying to update a cell in a google sheets spreadsheet using the api with node js, and it gives me an error saying 'Invalid JSON payload received. Unknown name "responce[values]"'.
async function setSquare(){
let array = [['2']];
const client = await auth.getClient();
const googleSheets = google.sheets({version: "v4", auth: client});
let res = await googleSheets.spreadsheets.values.update({
auth,
spreadsheetId,
range: "Sheet1!B1",
valueInputOption: "USER_ENTERED",
responce: {values: array}
});
}
This is my current code, I looked up other people's code and this seems to work fine, but for me it doesnt. When I leave the array empty it works but of course does not change anything in the spreadsheet, when I enter a value in the array it stops working and gives me this error
Upvotes: 0
Views: 151
Reputation: 1470
async function setSquare(){
let array = [['2']];
const client = await auth.getClient();
const googleSheets = google.sheets({version: "v4", auth: client});
let res = await googleSheets.spreadsheets.values.update({
auth,
spreadsheetId,
range: "Sheet1!B1",
valueInputOption: "USER_ENTERED",
resource: {values: array} // <-- Update
});
}
Based on this sample the body value that will contain the array is called resource
.
Upvotes: 0