The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "Preventing simultaneous executions for scheduled workflows",
"nodes": [
{
"parameters": {
"content": "## Preventing Simultaneous Executions of Scheduled Workflows\n\nThis n8n template provides a robust solution for processing data from Google Sheets in a controlled manner, specifically designed to **prevent simultaneous executions of a scheduled workflow**. This is crucial for maintaining data integrity, avoiding race conditions, and ensuring that your automated processes handle data sequentially.\n\n### What This Workflow Does and Why It's Important\n\nMany automated tasks involve processing a list of items, like rows in a Google Sheet. If a workflow is scheduled to run every minute, but a single run takes longer than a minute to complete, you could end up with multiple instances of the same workflow running concurrently. This can lead to:\n\n* **Data Duplication**: Processing the same row multiple times.\n* **Data Corruption**: Inconsistent updates or overwrites.\n* **Resource Exhaustion**: Overloading your systems or API rate limits.\n\nThis template solves this by leveraging n8n's **workflow runtime timeout feature**. By setting the workflow's runtime timeout to be equal to or slightly less than its scheduled execution frequency, you ensure that only one instance of the workflow can run at any given time. Once a workflow run successfully completes, it updates a status in your Google Sheet, marking the processed rows and preventing them from being picked up again in subsequent runs. This guarantees sequential, reliable data processing and avoids conflicts.\n\n### Step-by-Step Setup Instructions\n\n1. **Import the Template**: Import this workflow into your n8n instance.\n2. **Google Sheets Credential**: Ensure you have a Google Sheets credential configured in n8n and connected to the Google Sheets nodes within the workflow.\n3. **Specify Spreadsheet and Sheet Name**: In the \"Google Sheet\" node, update the Spreadsheet ID and Sheet Name to point to your specific Google Sheet. You can use this [example Google Sheet](https://docs.google.com/spreadsheets/d/1hKwP2_G6EaVSJlqWH1zYMVjarb9cuBx78D_U3HBrdhQ/edit?usp=sharing) for reference.\n4. **Configure Processing Logic**: Customize the nodes between the \"Read Google Sheet\" and \"Update Google Sheet\" steps to perform your desired data processing logic (e.g., sending emails, updating a CRM, making API calls).\n5. **Set Up Schedule**: Activate the workflow and configure its trigger (e.g., \"Cron\" node) to run on your desired schedule.\n6. **Configure Workflow Timeout**: In your n8n workflow settings, set the Workflow Timeout to a value equal to or slightly less than your scheduled execution frequency (e.g., if scheduled every 5 minutes, set timeout to 4 minutes 50 seconds).\n\nMore details in my [n8n tips blog](https://n8nplaybook.com/post/2025/07/how-to-prevent-concurrent-n8n-workflows/).",
"height": 728,
"width": 1148
},
"type": "n8n-nodes-base.stickyNote",
"position": [
32,
-592
],
"typeVersion": 1,
"id": "ac9d5f0d-5fbd-4a26-93e4-a9b7ba66a7f1",
"name": "Sticky Note"
},
{
"parameters": {
"options": {}
},
"type": "n8n-nodes-base.splitInBatches",
"typeVersion": 3,
"position": [
448,
192
],
"id": "c775e4d0-68c8-400c-adcc-3ffc1c43819c",
"name": "Loop Over Items"
},
{
"parameters": {
"authentication": "serviceAccount",
"documentId": {
"__rl": true,
"value": "1hKwP2_G6EaVSJlqWH1zYMVjarb9cuBx78D_U3HBrdhQ",
"mode": "list",
"cachedResultName": "Tip #5: Fixing Google Sheets quota exceeding issue",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1hKwP2_G6EaVSJlqWH1zYMVjarb9cuBx78D_U3HBrdhQ/edit?usp=drivesdk"
},
"sheetName": {
"__rl": true,
"value": "gid=0",
"mode": "list",
"cachedResultName": "Sheet1",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1hKwP2_G6EaVSJlqWH1zYMVjarb9cuBx78D_U3HBrdhQ/edit#gid=0"
},
"filtersUI": {
"values": [
{
"lookupColumn": "Status",
"lookupValue": "READY"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.6,
"position": [
224,
288
],
"id": "ae6127ea-e503-4c24-ad19-6733ed07e87a",
"name": "Read Google Sheets",
"credentials": {
"googleApi": {
"name": "<your credential>"
}
},
"onError": "continueErrorOutput"
},
{
"parameters": {
"authentication": "serviceAccount",
"operation": "update",
"documentId": {
"__rl": true,
"value": "1hKwP2_G6EaVSJlqWH1zYMVjarb9cuBx78D_U3HBrdhQ",
"mode": "list",
"cachedResultName": "Tip #5: Fixing Google Sheets quota exceeding issue",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1hKwP2_G6EaVSJlqWH1zYMVjarb9cuBx78D_U3HBrdhQ/edit?usp=drivesdk"
},
"sheetName": {
"__rl": true,
"value": "gid=0",
"mode": "list",
"cachedResultName": "Sheet1",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1hKwP2_G6EaVSJlqWH1zYMVjarb9cuBx78D_U3HBrdhQ/edit#gid=0"
},
"columns": {
"mappingMode": "autoMapInputData",
"value": {},
"matchingColumns": [
"row_number"
],
"schema": [
{
"id": "Color",
"displayName": "Color",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Status",
"displayName": "Status",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Number",
"displayName": "Number",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "row_number",
"displayName": "row_number",
"required": false,
"defaultMatch": false,
"display": true,
"type": "number",
"canBeUsedToMatch": true,
"readOnly": true,
"removed": false
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.6,
"position": [
1088,
288
],
"id": "810336b0-1a21-448a-87a1-9bb4388ce9ae",
"name": "Update Google Sheets",
"credentials": {
"googleApi": {
"name": "<your credential>"
}
},
"onError": "continueErrorOutput"
},
{
"parameters": {
"rule": {
"interval": [
{
"field": "minutes"
}
]
}
},
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.2,
"position": [
32,
288
],
"id": "efa03f8c-e27d-47eb-b671-f42265ccbece",
"name": "Schedule Trigger"
},
{
"parameters": {
"amount": "={{ Math.round(Math.random() * 60) }}"
},
"type": "n8n-nodes-base.wait",
"typeVersion": 1.1,
"position": [
656,
288
],
"id": "d11b9464-0510-404d-82c1-a2aac71a67cc",
"name": "Wait random seconds (workload)"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "4a875792-664d-4c97-af72-1252c86cc64a",
"name": "row_number",
"value": "={{ $json.row_number }}",
"type": "number"
},
{
"id": "cd47a508-aad7-4c7c-94cc-15752e8ede05",
"name": "Number",
"value": "={{ $json.Color.length }}",
"type": "number"
},
{
"id": "b67e8c39-f3f9-4614-9b5d-96876cb6a669",
"name": "Status",
"value": "DONE",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
880,
288
],
"id": "fe31d962-d720-4ba4-8ef3-4827f7f965a0",
"name": "Prepare output"
},
{
"parameters": {
"amount": "=1",
"unit": "minutes"
},
"type": "n8n-nodes-base.wait",
"typeVersion": 1.1,
"position": [
1088,
528
],
"id": "512983c7-5f71-470a-a4eb-ff819483a137",
"name": "Wait after quota error"
},
{
"parameters": {
"amount": "=1",
"unit": "minutes"
},
"type": "n8n-nodes-base.wait",
"typeVersion": 1.1,
"position": [
224,
528
],
"id": "625ad76b-deea-4a34-a9cd-5c706282bdae",
"name": "Wait after quota error 2"
}
],
"connections": {
"Loop Over Items": {
"main": [
[],
[
{
"node": "Wait random seconds (workload)",
"type": "main",
"index": 0
}
]
]
},
"Read Google Sheets": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
],
[
{
"node": "Wait after quota error 2",
"type": "main",
"index": 0
}
]
]
},
"Update Google Sheets": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
],
[
{
"node": "Wait after quota error",
"type": "main",
"index": 0
}
]
]
},
"Schedule Trigger": {
"main": [
[
{
"node": "Read Google Sheets",
"type": "main",
"index": 0
}
]
]
},
"Wait random seconds (workload)": {
"main": [
[
{
"node": "Prepare output",
"type": "main",
"index": 0
}
]
]
},
"Prepare output": {
"main": [
[
{
"node": "Update Google Sheets",
"type": "main",
"index": 0
}
]
]
},
"Wait after quota error": {
"main": [
[
{
"node": "Update Google Sheets",
"type": "main",
"index": 0
}
]
]
},
"Wait after quota error 2": {
"main": [
[
{
"node": "Read Google Sheets",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1",
"callerPolicy": "workflowsFromSameOwner",
"executionTimeout": 300
},
"versionId": "7821f3cc-f69d-4bea-ba98-819d651fa669",
"meta": {
"templateCredsSetupCompleted": true
},
"id": "AnwVFKf8Tm5HHiyk",
"tags": []
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
googleApi
About this workflow
Preventing simultaneous executions for scheduled workflows. Uses stickyNote, splitInBatches, googleSheets, scheduleTrigger. Scheduled trigger; 9 nodes.
Source: https://github.com/vklepikovskiy/n8nplaybook-public/blob/main/workflows/simultaneous_executions.json — original creator credit. Request a take-down →