Google Sheets Append is overwriting

IDescribe the problem/error/question

I have a very simple workflow that is triggered by a webhook and appends the data from the webhook in a new row in my Google Sheet. It works well, but I’ve noticed an edge case where the webhook receives two different requests almost simultaneously. Both workflows report that they executed successfully, but when I look at the data in Sheets, I find that only one new row was appended. If I look at the cell history, I can see that the data that being shown in the cell actually overwrote the data from the other request that occurred at the same time. I assume that I’m not the first person to encounter this issue. Is there a way to address it? I suppose that I could update the workflow to pause for 5 seconds, and then confirm that the data is there, but I’d rather avoid the problem then work around it.

What is the error message (if any)?

None.

Please share your workflow

{
“nodes”: [
{
“parameters”: {
“httpMethod”: “POST”,
“path”: “188a8ece-c32e-4eda-a235-e3f3ca47b735”,
“options”: {}
},
“id”: “bd1b51c6-fd98-4bdb-ae33-2b6c143ab5c6”,
“name”: “Webhook”,
“type”: “n8n-nodes-base.webhook”,
“typeVersion”: 1,
“position”: [
660,
300
],
“webhookId”: “188a8ece-c32e-4eda-a235-e3f3ca47b735”
},
{
“parameters”: {
“operation”: “append”,
“documentId”: {
“__rl”: true,
“value”: “1Jc-GYnIg54UXTfO2_yjj_ICrGr3qUwYz0CUVWqfSJ8w”,
“mode”: “list”,
“cachedResultName”: “Resident Call Logs”,
“cachedResultUrl”: “https://docs.google.com/spreadsheets/d/1Jc-GYnIg54UXTfO2_yjj_ICrGr3qUwYz0CUVWqfSJ8w/edit?usp=drivesdk
},
“sheetName”: {
“__rl”: true,
“value”: “gid=0”,
“mode”: “list”,
“cachedResultName”: “Sheet1”,
“cachedResultUrl”: “https://docs.google.com/spreadsheets/d/1Jc-GYnIg54UXTfO2_yjj_ICrGr3qUwYz0CUVWqfSJ8w/edit#gid=0
},
“fieldsUi”: {
“fieldValues”: [
{
“fieldId”: “ID”,
“fieldValue”: “={{ $json.body.entry_id }}”
},
{
“fieldId”: “Timestamp”,
“fieldValue”: “={{ $json.body.Timestamp }}”
},
{
“fieldId”: “Senior”,
“fieldValue”: “={{ $json.body[‘Senior Name’] }}”
},
{
“fieldId”: “Community”,
“fieldValue”: “={{ $json.body.Community }}”
},
{
“fieldId”: “Call Support”,
“fieldValue”: “={{ $json.body[‘Call Support’] }}”
},
{
“fieldId”: “Call Support Email”,
“fieldValue”: “={{ $json.body[‘Call Support Email’] }}”
},
{
“fieldId”: “Canceled”,
“fieldValue”: “={{ $json.body[‘Call Canceled’] }}”
},
{
“fieldId”: “Cancellation Reason”,
“fieldValue”: “={{ $json.body[‘Cancellation Reason’] }}”
},
{
“fieldId”: “Volunteer 1”,
“fieldValue”: “={{ $json.body[‘Volunteer 1’] }}”
},
{
“fieldId”: “Attendance 1”,
“fieldValue”: “={{ $json.body[‘Attendance 1’] }}”
},
{
“fieldId”: “Volunteer 2”,
“fieldValue”: “={{ $json.body[‘Volunteer 2’] }}”
},
{
“fieldId”: “Attendance 2”,
“fieldValue”: “={{ $json.body[‘Attendance 2’] }}”
},
{
“fieldId”: “Volunteer 3”,
“fieldValue”: “={{ $json.body[‘Volunteer 3’] }}”
},
{
“fieldId”: “Attendance 3”,
“fieldValue”: “={{ $json.body[‘Attendance 3’] }}”
},
{
“fieldId”: “Substitute 1”,
“fieldValue”: “={{ $json.body[‘Substitute 1’] }}”
},
{
“fieldId”: “Sub Attendance 1”,
“fieldValue”: “={{ $json.body[‘Sub Attendance 1’] }}”
},
{
“fieldId”: “Substitute 2”,
“fieldValue”: “={{ $json.body[‘Substitute 2’] }}”
},
{
“fieldId”: “Sub Attendance 2”,
“fieldValue”: “={{ $json.body[‘Sub Attendance 2’] }}”
},
{
“fieldId”: “Substitute 3”,
“fieldValue”: “={{ $json.body[‘Substitute 3’] }}”
},
{
“fieldId”: “Sub Attendance 3”,
“fieldValue”: “={{ $json.body[‘Sub Attendance 3’] }}”
},
{
“fieldId”: “Cancelation timing”,
“fieldValue”: “={{ $json.body[‘Cancelation timing’] }}”
},
{
“fieldId”: “On time 1”,
“fieldValue”: “={{ $json.body[‘On time 2’] }}”
},
{
“fieldId”: “On time 2”,
“fieldValue”: “={{ $json.body[‘On time 2’] }}”
},
{
“fieldId”: “On time 3”,
“fieldValue”: “={{ $json.body[‘On time 3’] }}”
},
{
“fieldId”: “Sub on time 1”,
“fieldValue”: “={{ $json.body[‘Sub on time 2’] }}”
},
{
“fieldId”: “Sub on time 2”,
“fieldValue”: “={{ $json.body[‘Sub on time 2’] }}”
},
{
“fieldId”: “Sub on time 3”,
“fieldValue”: “={{ $json.body[‘Sub on time 3’] }}”
}
]
},
“options”: {
“cellFormat”: “USER_ENTERED”
}
},
“id”: “2ed5bdb8-9589-4276-9b33-5f6d9355ef43”,
“name”: “Google Sheets”,
“type”: “n8n-nodes-base.googleSheets”,
“typeVersion”: 3,
“position”: [
880,
300
],
“retryOnFail”: true,
“waitBetweenTries”: 3000,
“maxTries”: 5,
“credentials”: {
“googleSheetsOAuth2Api”: {
“id”: “1”,
“name”: “Google Sheets account”
}
}
}
],
“connections”: {
“Webhook”: {
“main”: [
[
{
“node”: “Google Sheets”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“pinData”: {}
}

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 1.72.1
  • **Database (default: SQLite):**SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • **Running n8n via (Docker, npm, n8n cloud, desktop app):**Docker
  • Operating system: Ubuntu 22.04.5

I was facing the same issue with a workflow that was fine before and started overwriting after I updated the node.

Maybe it’s a bug of the most recent version of the Sheets node.

Post your workflow inside a code tag. It’s better to visualize.

Like this

I think that it is essentially the same thing as if two people edited the same cell at the same time. The first person’s entry is overwritten.

{
“nodes”: [
{
“parameters”: {
“httpMethod”: “POST”,
“path”: “188a8ece-c32e-4eda-a235-e3f3ca47b735”,
“options”: {}
},
“id”: “bd1b51c6-fd98-4bdb-ae33-2b6c143ab5c6”,
“name”: “Webhook”,
“type”: “n8n-nodes-base.webhook”,
“typeVersion”: 1,
“position”: [
660,
300
],
“webhookId”: “188a8ece-c32e-4eda-a235-e3f3ca47b735”
},
{
“parameters”: {
“operation”: “append”,
“documentId”: {
“__rl”: true,
“value”: “1Jc-GYnIg54UXTfO2_yjj_ICrGr3qUwYz0CUVWqfSJ8w”,
“mode”: “list”,
“cachedResultName”: “Resident Call Logs”,
“cachedResultUrl”: “https://docs.google.com/spreadsheets/d/1Jc-GYnIg54UXTfO2_yjj_ICrGr3qUwYz0CUVWqfSJ8w/edit?usp=drivesdk”
},
“sheetName”: {
“__rl”: true,
“value”: “gid=0”,
“mode”: “list”,
“cachedResultName”: “Sheet1”,
“cachedResultUrl”: “https://docs.google.com/spreadsheets/d/1Jc-GYnIg54UXTfO2_yjj_ICrGr3qUwYz0CUVWqfSJ8w/edit#gid=0”
},
“fieldsUi”: {
“fieldValues”: [
{
“fieldId”: “ID”,
“fieldValue”: “={{ $json.body.entry_id }}”
},
{
“fieldId”: “Timestamp”,
“fieldValue”: “={{ $json.body.Timestamp }}”
},
{
“fieldId”: “Senior”,
“fieldValue”: “={{ $json.body[‘Senior Name’] }}”
},
{
“fieldId”: “Community”,
“fieldValue”: “={{ $json.body.Community }}”
},
{
“fieldId”: “Call Support”,
“fieldValue”: “={{ $json.body[‘Call Support’] }}”
},
{
“fieldId”: “Call Support Email”,
“fieldValue”: “={{ $json.body[‘Call Support Email’] }}”
},
{
“fieldId”: “Canceled”,
“fieldValue”: “={{ $json.body[‘Call Canceled’] }}”
},
{
“fieldId”: “Cancellation Reason”,
“fieldValue”: “={{ $json.body[‘Cancellation Reason’] }}”
},
{
“fieldId”: “Volunteer 1”,
“fieldValue”: “={{ $json.body[‘Volunteer 1’] }}”
},
{
“fieldId”: “Attendance 1”,
“fieldValue”: “={{ $json.body[‘Attendance 1’] }}”
},
{
“fieldId”: “Volunteer 2”,
“fieldValue”: “={{ $json.body[‘Volunteer 2’] }}”
},
{
“fieldId”: “Attendance 2”,
“fieldValue”: “={{ $json.body[‘Attendance 2’] }}”
},
{
“fieldId”: “Volunteer 3”,
“fieldValue”: “={{ $json.body[‘Volunteer 3’] }}”
},
{
“fieldId”: “Attendance 3”,
“fieldValue”: “={{ $json.body[‘Attendance 3’] }}”
},
{
“fieldId”: “Substitute 1”,
“fieldValue”: “={{ $json.body[‘Substitute 1’] }}”
},
{
“fieldId”: “Sub Attendance 1”,
“fieldValue”: “={{ $json.body[‘Sub Attendance 1’] }}”
},
{
“fieldId”: “Substitute 2”,
“fieldValue”: “={{ $json.body[‘Substitute 2’] }}”
},
{
“fieldId”: “Sub Attendance 2”,
“fieldValue”: “={{ $json.body[‘Sub Attendance 2’] }}”
},
{
“fieldId”: “Substitute 3”,
“fieldValue”: “={{ $json.body[‘Substitute 3’] }}”
},
{
“fieldId”: “Sub Attendance 3”,
“fieldValue”: “={{ $json.body[‘Sub Attendance 3’] }}”
},
{
“fieldId”: “Cancelation timing”,
“fieldValue”: “={{ $json.body[‘Cancelation timing’] }}”
},
{
“fieldId”: “On time 1”,
“fieldValue”: “={{ $json.body[‘On time 2’] }}”
},
{
“fieldId”: “On time 2”,
“fieldValue”: “={{ $json.body[‘On time 2’] }}”
},
{
“fieldId”: “On time 3”,
“fieldValue”: “={{ $json.body[‘On time 3’] }}”
},
{
“fieldId”: “Sub on time 1”,
“fieldValue”: “={{ $json.body[‘Sub on time 2’] }}”
},
{
“fieldId”: “Sub on time 2”,
“fieldValue”: “={{ $json.body[‘Sub on time 2’] }}”
},
{
“fieldId”: “Sub on time 3”,
“fieldValue”: “={{ $json.body[‘Sub on time 3’] }}”
}
]
},
“options”: {
“cellFormat”: “USER_ENTERED”
}
},
“id”: “2ed5bdb8-9589-4276-9b33-5f6d9355ef43”,
“name”: “Google Sheets”,
“type”: “n8n-nodes-base.googleSheets”,
“typeVersion”: 3,
“position”: [
880,
300
],
“retryOnFail”: true,
“waitBetweenTries”: 3000,
“maxTries”: 5,
“credentials”: {
“googleSheetsOAuth2Api”: {
“id”: “1”,
“name”: “Google Sheets account”
}
}
}
],
“connections”: {
“Webhook”: {
“main”: [
[
{
“node”: “Google Sheets”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“pinData”: {}
}

I figured out a way to solve this. I’ve created a database outside of N8N, and added credentials to access it from N8N. The database has a single table with rows for each sheet that I use in my workflows. The table has a column for sheet name and for lock status. Each time I want to write a row, I pass the sheet name to a subflow, which checks the database to see if the sheet is locked. If not, I lock the sheet and return to the main flow to make the updates. If it was locked, I wait a random amount of time between 5 and 25 seconds to allow the existing update request to process, and then I check again. Once everything is complete, I unlock the sheet.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.