i am using javascript only to read and write values in google spreadsheet (private sheet using oAuth). I can successfully read the values but i am getting issue on modifying the sheet. below is my code for updating the cell-
$.ajax({
type: 'post',
headers: {
Authorization: auth,
'content-type': 'application/json',
"access_token": auth,
},
data: JSON.stringify({ // generate from oAuthPlayground
"access_token": auth,
"range": "A1",
"values": [
[
"32",
]
]
}),
url: 'https://sheets.googleapis.com/v4/spreadsheets/' + sheetId + '/values/A2:batchUpdate?insertDataOption=INSERT_ROWS&valueInputOption=RAW',
success: function (r) {
console.log(r)
}, error: function (r) {
console.log(r)
}
});
anybody can suggest what is the mistake. Again i am using only ajax not node.js or google script.