I am facing an issue similar to another question regarding fetching spreadsheet data, but instead, I need to add data to a Google Sheet. Below is the curl command I am using:
curl -H "Content-Type: application/json" -X POST -d '{"range":"A1","majorDimension":"ROWS","values":[["Frank2"]]}' https://sheets.googleapis.com/v4/spreadsheets/{YOUR_SPREADSHEET_ID}/values/A1:append?valueInputOption=RAW&key={YOUR_API_KEY}
The response I am getting is:
{
"error": {
"code": 401,
"message": "The request does not have valid authentication credentials.",
"status": "UNAUTHENTICATED"
}
}
Is it feasible to achieve this only with an API Key, or am I possibly making an error? The documentation indicates that it should work if the spreadsheet is publicly accessible.