Reputation: 10284
I am attempting to append information onto a spreadsheet with the following code.
let values = [
[
[tweet.user.name, tweet.user.client_id]
]
];
let resource = {
values,
};
const sheets = google.sheets({version: 'v4', oAuth2Client});
sheets.spreadsheets.values.append({
auth: oAuth2Client,
spreadsheetId: '***redacted***',
range: 'A:C',
valueInputOption: 'RAW',
resource,
}, (err, result) => {
if (err) {
// Handle error.
console.log(err);
} else {
console.log(`${result.updates.updatedCells} cells appended.`);
}
});
However I am receiving this error. I think it's some sort of formatting issue, but I have no idea what it could be.
'Invalid values[2][0]: list_value {\n values {\n string_value: "Structure of Reign"\n }\n values {\n null_value: NULL_VALUE\n }\n}\n',
Upvotes: 1
Views: 3932
Reputation: 201388
How about this modification?
values
is required to be 2 dimensional array.result.data
.{\n values {\n string_value: "Structure of Reign"\n }\n values {\n null_value: NULL_VALUE\n }\n}\n
indicates that tweet.user.client_id
is undefined, while tweet.user.name
has a value of Structure of Reign
.
tweet.user.client_id
, because I'm not sure about your situation.Please modify as follows.
From:let values = [[[tweet.user.name, tweet.user.client_id]]];
To:
let values = [[tweet.user.name, tweet.user.client_id]];
And
From:console.log(`${result.updates.updatedCells} cells appended.`);
To:
console.log(`${result.data.updates.updatedCells} cells appended.`);
If this modification didn't work, I apologize.
Upvotes: 4