{
  "name": "Automate marketing leads import from Google Sheets to Airtable CRM",
  "nodes": [
    {
      "id": "090c0c78-fa41-41cd-affa-188714c72e96",
      "name": "When clicking ‘Execute workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -2016,
        464
      ]
    },
    {
      "id": "70f16c39-5979-4ee8-be93-62ebbf6c66da",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2224,
        -128
      ],
      "parameters": {
        "width": 716,
        "height": 488,
        "content": "### How it works:\n1. Initialisation\n   * intialisation of counters from \"Data Table\"\n   * lead selection and loading from Google Sheet\n\n2. Import of leads into CRM according 3 possibilities:\n   2.1 co"
      }
    },
    {
      "id": "6aaeb094-4842-4153-b594-88feeb214860",
      "name": "Update row(s)",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        -1040,
        480
      ]
    },
    {
      "id": "70c5df1b-ae7b-43f8-87ba-ff3cab94511f",
      "name": "Get row(s)",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        -1232,
        480
      ]
    },
    {
      "id": "e27e9dcb-29f2-40e9-9ff5-6aaa44e39e91",
      "name": "Insert row",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        -1824,
        464
      ]
    },
    {
      "id": "abd4b1e1-5efc-4684-ba40-22220e1d2ae0",
      "name": "Limit",
      "type": "n8n-nodes-base.limit",
      "position": [
        -1040,
        -32
      ]
    },
    {
      "id": "81f73d48-a6d4-47b8-b5f5-fc9543d42edb",
      "name": "Get row(s)1",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        -864,
        -32
      ]
    },
    {
      "id": "965719fb-0aa3-4c3b-8730-0ab54c706909",
      "name": "Send a message",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -672,
        -32
      ]
    },
    {
      "id": "a1258104-697e-47ac-bdae-b640f8a42b47",
      "name": "Wait1",
      "type": "n8n-nodes-base.wait",
      "position": [
        256,
        656
      ]
    },
    {
      "id": "d48c78a4-14b5-43b0-8346-3cc02998df73",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -896,
        192
      ],
      "parameters": {
        "width": 544,
        "height": 608,
        "content": "### Determination of retuned row(s) :\n**none :** no exisitng company\n**one :** only one exisitng company\n**multiple :** multiple existing occurrences of the same company\n\nWhen there are multiple occur"
      }
    },
    {
      "id": "ade429d2-7b9f-48bd-b469-6150f5424117",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -288,
        192
      ],
      "parameters": {
        "width": 448,
        "height": 192,
        "content": "### Creation of a new company"
      }
    },
    {
      "id": "5025ced0-adf1-431b-a6d1-4c7be6c5d062",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -288,
        400
      ],
      "parameters": {
        "width": 448,
        "height": 192,
        "content": "### Update of existing company"
      }
    },
    {
      "id": "475be580-d995-447d-8c77-0d8ed20e4f90",
      "name": "Create Company",
      "type": "n8n-nodes-base.airtable",
      "position": [
        -208,
        240
      ]
    },
    {
      "id": "478376a9-0322-4b91-abf4-2b18b3aeb8e7",
      "name": "Update row(s) - Creation",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        0,
        240
      ]
    },
    {
      "id": "f31d06a1-6a9c-4270-abe8-98cd151dd848",
      "name": "Update row(s) - Update",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        0,
        448
      ]
    },
    {
      "id": "83710b3d-b32b-40b2-bc28-be7350f8754b",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "position": [
        -672,
        480
      ]
    },
    {
      "id": "7094a155-5554-42e8-adf0-3321fdee2a3b",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        -496,
        464
      ]
    },
    {
      "id": "819ea443-b06a-4d20-ab2f-e565202c8034",
      "name": "Get row(s) Leads",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1632,
        464
      ]
    },
    {
      "id": "12750d62-e59c-4a5a-8f2e-b1d1c077ef7b",
      "name": "Search Company",
      "type": "n8n-nodes-base.airtable",
      "position": [
        -848,
        480
      ]
    },
    {
      "id": "5d77c157-2913-4664-8a62-224ab4a58f8a",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -1440,
        464
      ]
    },
    {
      "id": "92040fed-ecad-4dba-8955-cd7456cc252b",
      "name": "Update Company",
      "type": "n8n-nodes-base.airtable",
      "position": [
        -208,
        448
      ]
    },
    {
      "id": "a092f0eb-0aaa-4074-8cc2-6c28b8e92330",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -288,
        608
      ],
      "parameters": {
        "width": 448,
        "height": 192,
        "content": "### Data Quality Issue ➡️ Log"
      }
    },
    {
      "id": "72e037b6-3d72-477b-8d8c-e56063548e6b",
      "name": "Create row(s) Logs",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -208,
        656
      ]
    },
    {
      "id": "7e6e8c4e-f589-4201-add1-b191969914b4",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2224,
        384
      ],
      "parameters": {
        "width": 720,
        "height": 432,
        "content": "## 1. Initialisation\n"
      }
    },
    {
      "id": "e76ebbde-b82b-4a35-ba3d-72c3e1538fe5",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1456,
        176
      ],
      "parameters": {
        "width": 1824,
        "height": 640,
        "content": "## 2. Import of leads  (Iterative Loop)"
      }
    },
    {
      "id": "1c5ca6ff-0aaa-4850-8de0-dc30655e9d8c",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1136,
        -128
      ],
      "parameters": {
        "width": 784,
        "height": 272,
        "content": "## 3. Generation of import report\n"
      }
    }
  ],
  "connections": {
    "Code": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Limit": {
      "main": [
        [
          {
            "node": "Get row(s)1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait1": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Create Company",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Update Company",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create row(s) Logs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s)": {
      "main": [
        [
          {
            "node": "Update row(s)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Insert row": {
      "main": [
        [
          {
            "node": "Get row(s) Leads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s)1": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update row(s)": {
      "main": [
        [
          {
            "node": "Search Company",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Company": {
      "main": [
        [
          {
            "node": "Update row(s) - Creation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search Company": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Company": {
      "main": [
        [
          {
            "node": "Update row(s) - Update",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Limit",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get row(s)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) Leads": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create row(s) Logs": {
      "main": [
        [
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update row(s) - Update": {
      "main": [
        [
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update row(s) - Creation": {
      "main": [
        [
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Insert row",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}