Hi,
How can I iterate different pages from google sheets so I can compare the values of my database to customer data. At the end of the iteration I want the slack node to send message which works but I want to do the same process over and over until I have finished the sheets. {
“name”: “My workflow 5”,
“nodes”: [
{
“parameters”: {},
“type”: “n8n-nodes-base.manualTrigger”,
“typeVersion”: 1,
“position”: [
0,
0
\],
“id”: “564d0e12-58f5-4647-a39e-73a284322224”,
“name”: “When clicking ‘Execute workflow’”
},
{
“parameters”: {
“assignments”: {
“assignments”: [
{
“id”: “80c9ff6c-bdab-44ed-8100-4489e71c762e”,
“name”: “Magaza”,
“value”: “={{ $json[\“Satır Etiketleri\”] }}”,
“type”: “string”
},
{
“id”: “302b32c3-18fd-48f7-b2d7-d88beebdf0e6”,
“name”: “Sube Sayisi”,
“value”: “={{ $json.gvg_uid }}”,
“type”: “string”
},
{
“id”: “726abca3-2b20-497e-bd42-b369616d9345”,
“name”: “Magaza_id”,
“value”: “={{ $json.Magaza_id }}”,
“type”: “string”
}
\]
},
“options”: {}
},
“type”: “n8n-nodes-base.set”,
“typeVersion”: 3.4,
“position”: [
512,
0
\],
“id”: “22c1d8af-522a-4b24-af63-3593d6dbd5ae”,
“name”: “Edit Fields”
},
{
“parameters”: {
“documentId”: {
“__rl”: true,
“value”: “1m4THXF2wL9xu-7suFKXn4Cm3uzW6gYlT-19Ei1A65QU”,
“mode”: “list”,
“cachedResultName”: “Musteri-datasi”,
“cachedResultUrl”: “https://docs.google.com/spreadsheets/d/1m4THXF2wL9xu-7suFKXn4Cm3uzW6gYlT-19Ei1A65QU/edit?usp=drivesdk”
},
“sheetName”: {
“__rl”: true,
“value”: “gid=0”,
“mode”: “list”,
“cachedResultName”: “Sayfa1”,
“cachedResultUrl”: “https://docs.google.com/spreadsheets/d/1m4THXF2wL9xu-7suFKXn4Cm3uzW6gYlT-19Ei1A65QU/edit#gid=0”
},
“options”: {}
},
“type”: “n8n-nodes-base.googleSheets”,
“typeVersion”: 4.7,
“position”: [
160,
144
\],
“id”: “c8fc9d0c-fc0d-4400-9242-ce863ff1960e”,
“name”: “musteri-datasi”,
“credentials”: {
“googleSheetsOAuth2Api”: {
“id”: “”,
“name”: “Google Sheets account”
}
}
},
{
“parameters”: {
“documentId”: {
“__rl”: true,
“value”: “17Eoblixey-cdmTpxpedxSb0SiV-myDpR_T7heUfRbp0”,
“mode”: “list”,
“cachedResultName”: “Başlıksız e-tablo”,
“cachedResultUrl”: “https://docs.google.com/spreadsheets/d/17Eoblixey-cdmTpxpedxSb0SiV-myDpR_T7heUfRbp0/edit?usp=drivesdk”
},
“sheetName”: {
“__rl”: true,
“value”: 614090118,
“mode”: “list”,
“cachedResultName”: “Sayfa6”,
“cachedResultUrl”: “https://docs.google.com/spreadsheets/d/17Eoblixey-cdmTpxpedxSb0SiV-myDpR_T7heUfRbp0/edit#gid=614090118”
},
“options”: {}
},
“type”: “n8n-nodes-base.googleSheets”,
“typeVersion”: 4.7,
“position”: [
304,
0
\],
“id”: “1e5c723d-9413-4d76-93ab-144cdf39d5e5”,
“name”: “db”,
“credentials”: {
“googleSheetsOAuth2Api”: {
“id”: “”,
“name”: “Google Sheets account”
}
}
},
{
“parameters”: {
“conditions”: {
“options”: {
“caseSensitive”: true,
“leftValue”: “”,
“typeValidation”: “strict”,
“version”: 2
},
“conditions”: [
{
“id”: “21aa5ba1-019e-4ea3-ab5d-783340a8294c”,
“leftValue”: “={{ $json.Fark }}”,
“rightValue”: 0,
“operator”: {
“type”: “number”,
“operation”: “equals”
}
}
\],
“combinator”: “and”
},
“options”: {}
},
“type”: “n8n-nodes-base.if”,
“typeVersion”: 2.2,
“position”: [
1440,
144
\],
“id”: “574a6f6d-f964-4a17-bb3d-d24736a84075”,
“name”: “If”
},
{
“parameters”: {
“authentication”: “oAuth2”,
“select”: “channel”,
“channelId”: {
“__rl”: true,
“value”: “C09NU2ZGPA5”,
“mode”: “list”,
“cachedResultName”: “all-gvg”
},
“text”: “=Yeni sube bulunmamaktadır: {{ $json.Magaza }}\nGuncel Sube Sayisi:{{ $json[\“Sube Sayisi\”] }}”,
“otherOptions”: {}
},
“type”: “n8n-nodes-base.slack”,
“typeVersion”: 2.3,
“position”: [
1664,
-48
\],
“id”: “20e4511f-d166-43c6-a8e0-00d2de839edf”,
“name”: “Send a message”,
“webhookId”: “dc4ceb90-686d-408d-8a41-c8c5f983ceaa”,
“credentials”: {
“slackOAuth2Api”: {
“id”: “”,
“name”: “Slack account”
}
}
},
{
“parameters”: {
“jsCode”: “// n8n Code Node (JavaScript)\nconst inputData = items; // Bir önceki nodun çıktısı\nlet count = 0;\n\n// Eğer her item içinde \“id\” alanı varsa say\nfor (const item of inputData) {\n if (item.json.id !== undefined && item.json.id !== null) {\n count++;\n }\n}\n\n// Sonucu tek bir obje olarak döndür\nreturn [\n {\n json: {\n count: count, //
sayıyı string’e çeviriyoruz\n magaza: $input.first().json.magaza,\n Magaza_id: $input.first().json.Magaza_id\n }\n }\n];\n”
},
“type”: “n8n-nodes-base.code”,
“typeVersion”: 2,
“position”: [
448,
144
\],
“id”: “6af942ac-f045-454e-8220-6e5e16cfaa82”,
“name”: “test”
},
{
“parameters”: {
“conditions”: {
“options”: {
“caseSensitive”: true,
“leftValue”: “”,
“typeValidation”: “strict”,
“version”: 2
},
“conditions”: [
{
“id”: “afeaeee3-8830-46bc-9ce7-ac1d79e8aedc”,
“leftValue”: “={{ $json.Magaza_id }}”,
“rightValue”: “2”,
“operator”: {
“type”: “string”,
“operation”: “equals”,
“name”: “filter.operator.equals”
}
}
\],
“combinator”: “and”
},
“options”: {}
},
“type”: “n8n-nodes-base.filter”,
“typeVersion”: 2.2,
“position”: [
752,
0
\],
“id”: “819bbc5a-d7aa-4ed7-a1be-a1b47e5d8932”,
“name”: “Filter”
},
{
“parameters”: {},
“type”: “n8n-nodes-base.merge”,
“typeVersion”: 3.2,
“position”: [
928,
48
\],
“id”: “198a2bc6-7156-4e0b-b3b1-56d446f0db02”,
“name”: “Merge”
},
{
“parameters”: {
“assignments”: {
“assignments”: [
{
“id”: “3e63b782-6dce-45cc-a0c4-ecb6cb591dd3”,
“name”: “Fark”,
“value”: “={{ parseInt($(‘Filter’).first().json[\“Sube Sayisi\”]) - parseInt($(‘test’).first().json.count) }}\n”,
“type”: “number”
}
\]
},
“options”: {}
},
“type”: “n8n-nodes-base.set”,
“typeVersion”: 3.4,
“position”: [
1136,
48
\],
“id”: “887b67fe-e5d4-4fd1-a368-9da7ac4ad5dd”,
“name”: “Edit Fields2”
},
{
“parameters”: {
“conditions”: {
“options”: {
“caseSensitive”: true,
“leftValue”: “”,
“typeValidation”: “strict”,
“version”: 2
},
“conditions”: [
{
“id”: “62aeaaff-ef40-421b-8c2e-0fc58bb3e690”,
“leftValue”: “={{ $json.Fark }}”,
“rightValue”: 0,
“operator”: {
“type”: “number”,
“operation”: “gt”
}
}
\],
“combinator”: “and”
},
“options”: {}
},
“type”: “n8n-nodes-base.if”,
“typeVersion”: 2.2,
“position”: [
1648,
240
\],
“id”: “e9d1d723-f360-433d-b309-af85d0d05c62”,
“name”: “If1”
},
{
“parameters”: {
“authentication”: “oAuth2”,
“select”: “channel”,
“channelId”: {
“__rl”: true,
“value”: “C09NU2ZGPA5”,
“mode”: “list”,
“cachedResultName”: “all-gvg”
},
“text”: “=Databasede {{ $json.Mesaj }} nokta fazladir. Kontrol edilmesi gerekmektedir.”,
“otherOptions”: {}
},
“type”: “n8n-nodes-base.slack”,
“typeVersion”: 2.3,
“position”: [
2064,
144
\],
“id”: “093e3765-7388-4f84-81b9-d8ccec7e56c3”,
“name”: “Send a message1”,
“webhookId”: “f96db082-c8da-4a67-b218-582254f4c598”,
“credentials”: {
“slackOAuth2Api”: {
“id”: “”,
“name”: “Slack account”
}
}
},
{
“parameters”: {
“authentication”: “oAuth2”,
“select”: “channel”,
“channelId”: {
“__rl”: true,
“value”: “C09NU2ZGPA5”,
“mode”: “list”,
“cachedResultName”: “all-gvg”
},
“text”: “=Yeni nokta eklenmelidir. Fark: {{ $(‘If’).item.json.Fark }}”,
“otherOptions”: {}
},
“type”: “n8n-nodes-base.slack”,
“typeVersion”: 2.3,
“position”: [
1856,
336
\],
“id”: “d8e60ad6-0dc3-4751-9d1e-201230c21883”,
“name”: “Send a message2”,
“webhookId”: “5f5841a8-e415-493b-b6e6-7473f5f0be4a”,
“credentials”: {
“slackOAuth2Api”: {
“id”: “”,
“name”: “Slack account”
}
}
},
{
“parameters”: {
“jsCode”: “// n8n Code Node (JavaScript)\nconst allItems = items;\n\n// Eğer hiçbir item yoksa boş dön\nif (allItems.length === 0) {\n return ;\n}\n\n// Örneğin fark toplamını veya ilk mağazayı al\nlet totalFark = 0;\nlet sampleMagaza = allItems[0].json.Magaza || \“Bilinmiyor\”;\n\nfor (const item of allItems) {\n totalFark += item.json.Fark || 0;\n}\n\n// Sadece tek bir obje döndür → artık Slack’e sadece 1 item gidecek\nreturn [\n {\n json: {\n Magaza: sampleMagaza,\n ToplamFark: totalFark,\n Mesaj: `Toplam ${totalFark} fazla nokta var. Kontrol edilmeli.`\n }\n }\n];\n”
},
“type”: “n8n-nodes-base.code”,
“typeVersion”: 2,
“position”: [
1856,
144
\],
“id”: “d7aa394a-5c0f-40d1-a0c0-c93c49b1d216”,
“name”: “aggregate true items”
}
],
“pinData”: {},
“connections”: {
“When clicking ‘Execute workflow’”: {
“main”: [
\[
{
“node”: “db”,
“type”: “main”,
“index”: 0
},
{
“node”: “musteri-datasi”,
“type”: “main”,
“index”: 0
}
\]
\]
},
“Edit Fields”: {
“main”: [
\[
{
“node”: “Filter”,
“type”: “main”,
“index”: 0
}
\]
\]
},
“musteri-datasi”: {
“main”: [
\[
{
“node”: “test”,
“type”: “main”,
“index”: 0
}
\]
\]
},
“db”: {
“main”: [
\[
{
“node”: “Edit Fields”,
“type”: “main”,
“index”: 0
}
\]
\]
},
“If”: {
“main”: [
\[
{
“node”: “Send a message”,
“type”: “main”,
“index”: 0
}
\],
\[
{
“node”: “If1”,
“type”: “main”,
“index”: 0
}
\]
\]
},
“test”: {
“main”: [
\[
{
“node”: “Merge”,
“type”: “main”,
“index”: 1
}
\]
\]
},
“Filter”: {
“main”: [
\[
{
“node”: “Merge”,
“type”: “main”,
“index”: 0
}
\]
\]
},
“Merge”: {
“main”: [
\[
{
“node”: “Edit Fields2”,
“type”: “main”,
“index”: 0
}
\]
\]
},
“Edit Fields2”: {
“main”: [
\[
{
“node”: “If”,
“type”: “main”,
“index”: 0
}
\]
\]
},
“If1”: {
“main”: [
\[
{
“node”: “aggregate true items”,
“type”: “main”,
“index”: 0
}
\],
\[
{
“node”: “Send a message2”,
“type”: “main”,
“index”: 0
}
\]
\]
},
“aggregate true items”: {
“main”: [
\[
{
“node”: “Send a message1”,
“type”: “main”,
“index”: 0
}
\]
\]
},
“Send a message1”: {
“main”: [
\[\]
\]
}
},
“active”: false,
“settings”: {
“executionOrder”: “v1”
},
“versionId”: “10bbd5af-408c-47a0-be4e-9f2e9c28f588”,
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “33393efe88005d4862d96aa19eb0dd544e83dc9d3b965028edbfcf525a187df9”
},
“id”: “uaUbdzoTpV721c35”,
“tags”:
}
