Although I am specifying valueInputoption but still i am getting this error. I followed google sheet`s quickstart.js tutorial for authentication.
function appendData(auth) {
var sheets = google.sheets('v4');
values: [ ["Void", "Canvas", "Website"], ["Paul", "Shan", "Human"] ];
var body = {
values: this.values
};
sheets.spreadsheets.values.append({
auth: auth,
spreadsheetId: '13QPQj1Ot0oBJms2eQzrKahwzGt13JxQkqf54j2zk3jI',
range: 'Sheet1!A2:B', //Change Sheet1 if your worksheet's name is
//something else
valueInputOption: "USER_ENTERED",
insertDataOption: 'INSERT_ROWS',
resource: body
}, (err, response) => {
if (err) {
console.log('The API returned an error: ' + err);
return;
} else {
console.log("Appended");
}
});
}
First thing I suggest that you change is to use apostrophe (') instead of double quotes ("). If that doesn't work check my snippet taken from Sheets API NodeJS Quickstart combining it with the concepts of spreadsheets.values.append:
Let me know if it works for you.
Looks like it might be an issue with v^25.0. Switching to v24.0.0 resolved the issue for me:
... "dependencies": { "googleapis": "24.0.0", }, ...
https://gist.github.com/iaincollins/43302ea047d4a77e6605350598d160c1