Update or append in Google Sheet

Hi,

How would you go about “upserting” in Google Sheet ? I’ve worked something out that I thought would work, but doesn’t seem to.

My idea was to get the list of existing ads’ urls, and comparing with an IF node (if the ad’s URL isn’t in the existing links, append, else, update)

Edit:

Here’s what I’ve got so far, which encounters two problems: somehow the first Split In Batches, if activated, makes the HTTP Request fail with "ERROR: Error: Invalid URI "/" RequestError: Error: Invalid URI "/"", but the execution parameters show that the URL passed to the Node is correct. If I disable the Split in Batches node the Workflow proceeds to fail with ERROR: Cannot access 'items' before initialization ReferenceError: Cannot access 'items' before initialization at the Select New Ads Function node, which references the Links to Array node.

{
  "name": "Scrap Maisons du Perche",
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        -180,
        440
      ]
    },
    {
      "parameters": {
        "url": "= {{$node[\"SplitInBatches\"].json[\"link\"]}}",
        "responseFormat": "string",
        "dataPropertyName": "page",
        "options": {}
      },
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        450,
        420
      ]
    },
    {
      "parameters": {
        "dataPropertyName": "page",
        "extractionValues": {
          "values": [
            {
              "key": "ad_links",
              "cssSelector": ".property_listing h4 a",
              "returnValue": "attribute",
              "attribute": "href",
              "returnArray": true
            }
          ]
        },
        "options": {}
      },
      "name": "HTML Extract",
      "type": "n8n-nodes-base.htmlExtract",
      "typeVersion": 1,
      "position": [
        570,
        420
      ]
    },
    {
      "parameters": {
        "functionCode": "const newItems = [];\nitems[0]['json']['ad_links'].map(item => {\n  newItems.push({json: {link: item}});\n})\n\nreturn newItems;\n"
      },
      "name": "Split links",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        700,
        420
      ]
    },
    {
      "parameters": {
        "mode": "mergeByIndex",
        "join": "inner"
      },
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "typeVersion": 1,
      "position": [
        1230,
        420
      ]
    },
    {
      "parameters": {
        "conditions": {
          "boolean": [],
          "string": [
            {
              "value1": "={{$node[\"Links to Array\"].json}}",
              "operation": "contains",
              "value2": "="
            }
          ]
        }
      },
      "name": "Ad already exists",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        1420,
        700
      ],
      "notesInFlow": false
    },
    {
      "parameters": {
        "sheetId": "={{$node[\"Add Ads\"].parameter[\"sheetId\"]}}",
        "range": "Maisons!F1:F",
        "options": {
          "valueRenderMode": "UNFORMATTED_VALUE"
        }
      },
      "name": "Retrieve Existing Links",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 1,
      "position": [
        720,
        610
      ],
      "credentials": {
        "googleApi": "Google API"
      }
    },
    {
      "parameters": {
        "operation": "append",
        "sheetId": "azerty",
        "range": "Maisons!A1:Z",
        "options": {}
      },
      "name": "Add Ads",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 1,
      "position": [
        1550,
        500
      ],
      "credentials": {
        "googleApi": "Google API"
      }
    },
    {
      "parameters": {
        "operation": "update",
        "sheetId": "={{$node[\"Add Ads\"].parameter[\"sheetId\"]}}",
        "range": "= {{$node[\"Add Ads\"].parameter[\"range\"]}}",
        "key": "link",
        "options": {}
      },
      "name": "Update Ads",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 1,
      "position": [
        1540,
        350
      ],
      "credentials": {
        "googleApi": "Google API"
      }
    },
    {
      "parameters": {
        "functionCode": "return [{json: items.map(item => item['json']['link'])}];"
      },
      "name": "Links to Array",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        920,
        620
      ]
    },
    {
      "parameters": {
        "url": "={{$node[\"Split links\"].json[\"link\"]}}",
        "responseFormat": "string",
        "dataPropertyName": "ad_page",
        "options": {}
      },
      "name": "Retrieve ad HTML",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        820,
        120
      ]
    },
    {
      "parameters": {
        "dataPropertyName": "ad_page",
        "extractionValues": {
          "values": [
            {
              "key": "title",
              "cssSelector": "h1.entry-title:first-child"
            },
            {
              "key": "price",
              "cssSelector": ".price_area"
            },
            {
              "key": "description",
              "cssSelector": ".listing-content p",
              "returnArray": true
            },
            {
              "key": "department",
              "cssSelector": ".adres_area a:first-child"
            },
            {
              "key": "city",
              "cssSelector": ".adres_area a:last-child"
            },
            {
              "key": "photo_links",
              "cssSelector": "a.prettygalery",
              "returnValue": "attribute",
              "attribute": "href",
              "returnArray": true
            },
            {
              "key": "sold",
              "cssSelector": ".Vendu-par-nos-soins"
            }
          ]
        },
        "options": {}
      },
      "name": "Extract ad HTML",
      "type": "n8n-nodes-base.htmlExtract",
      "typeVersion": 1,
      "position": [
        960,
        130
      ]
    },
    {
      "parameters": {
        "functionCode": "const date = new Date()\nitem.description = item.description.join(\"\\n\");\nconst price = item.price.match(/(.+) €/)\nif (price) {\n  item.price = parseInt(price[1]) * 1000\n}\nconst department = item.department.match(/\\d+/)\nif (department) {\n  item.department = department[0]\n}\nitem.created_at = `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`\nitem.sold = item.sold && item.sold.includes('nos soins')\nreturn item;"
      },
      "name": "Format ad data",
      "type": "n8n-nodes-base.functionItem",
      "typeVersion": 1,
      "position": [
        1090,
        130
      ]
    },
    {
      "parameters": {
        "sheetId": "azerty",
        "range": "MaisonsURLS!A1:A9",
        "rawData": true,
        "options": {}
      },
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 1,
      "position": [
        -10,
        270
      ],
      "credentials": {
        "googleApi": "Google API"
      }
    },
    {
      "parameters": {
        "functionCode": "const newItems = [];\nitems[0]['json']['data'].map(item => {\n  newItems.push({json: {link: item[0]}});\n})\n\nreturn newItems;\n"
      },
      "name": "Split links1",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        120,
        270
      ]
    },
    {
      "parameters": {
        "batchSize": 1,
        "options": {}
      },
      "name": "SplitInBatches",
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 1,
      "position": [
        270,
        270
      ]
    },
    {
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": true,
              "value2": "=={{$node[\"SplitInBatches\"].context[\"noItemsLeft\"]}}"
            }
          ]
        }
      },
      "name": "IF",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        470,
        90
      ]
    },
    {
      "parameters": {
        "conditions": {
          "string": [],
          "boolean": [
            {
              "value1": "=false"
            }
          ]
        }
      },
      "name": "IF1",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        620,
        90
      ]
    },
    {
      "parameters": {
        "functionCode": "const existingLinks = $items(\"Links to Array\")[0]['json']\nconst items = items.filter(item => existingLinks.includes(item['json']['link']))\nreturn [{json: {items}}]"
      },
      "name": "Select Existing Ads",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        1370,
        350
      ]
    },
    {
      "parameters": {
        "functionCode": "const existingLinks = $items(\"Links to Array\")[0]['json']\nconst items = items.filter(item => !existingLinks.includes(item['json']['link']))\nreturn [{json: {items}}]\n"
      },
      "name": "Select New Ads",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        1370,
        500
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Google Sheets",
            "type": "main",
            "index": 0
          },
          {
            "node": "Retrieve Existing Links",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "HTML Extract",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTML Extract": {
      "main": [
        [
          {
            "node": "Split links",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split links": {
      "main": [
        [
          {
            "node": "Retrieve ad HTML",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Select New Ads",
            "type": "main",
            "index": 0
          },
          {
            "node": "Select Existing Ads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Retrieve Existing Links": {
      "main": [
        [
          {
            "node": "Links to Array",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Retrieve ad HTML": {
      "main": [
        [
          {
            "node": "Extract ad HTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract ad HTML": {
      "main": [
        [
          {
            "node": "Format ad data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format ad data": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets": {
      "main": [
        [
          {
            "node": "Split links1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split links1": {
      "main": [
        [
          {
            "node": "SplitInBatches",
            "type": "main",
            "index": 0
          },
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SplitInBatches": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add Ads": {
      "main": [
        [
          {
            "node": "IF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF": {
      "main": [
        [
          {
            "node": "IF1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "SplitInBatches",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Select Existing Ads": {
      "main": [
        [
          {
            "node": "Update Ads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Select New Ads": {
      "main": [
        [
          {
            "node": "Add Ads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Ads": {
      "main": [
        [
          {
            "node": "IF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {},
  "id": "9"
}

@pec an you give example sheet?

After a lot of trial and error I’ve got something that works flawlessly, as far as I can tell! This is my first real workflow so there are probably things that could be done in more straightforward ways…
I’ve obviously removed IDs and references to my GSheet but if it can help someone trying to achieve something similar:

{
  "name": "Scrap my website",
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        -200,
        320
      ]
    },
    {
      "parameters": {
        "url": "= {{$node[\"SplitInBatches\"].json[\"link\"]}}",
        "responseFormat": "string",
        "dataPropertyName": "page",
        "options": {}
      },
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        440,
        420
      ]
    },
    {
      "parameters": {
        "dataPropertyName": "page",
        "extractionValues": {
          "values": [
            {
              "key": "ad_links",
              "cssSelector": ".property_listing h4 a",
              "returnValue": "attribute",
              "attribute": "href",
              "returnArray": true
            }
          ]
        },
        "options": {}
      },
      "name": "HTML Extract",
      "type": "n8n-nodes-base.htmlExtract",
      "typeVersion": 1,
      "position": [
        570,
        420
      ]
    },
    {
      "parameters": {
        "mode": "mergeByIndex",
        "join": "inner"
      },
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "typeVersion": 1,
      "position": [
        1230,
        420
      ]
    },
    {
      "parameters": {
        "sheetId": "={{$node[\"Add Ads\"].parameter[\"sheetId\"]}}",
        "range": "Maisons!F1:F",
        "options": {
          "valueRenderMode": "UNFORMATTED_VALUE"
        }
      },
      "name": "Retrieve Existing Links",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 1,
      "position": [
        720,
        610
      ],
      "credentials": {
        "googleApi": "Google API"
      }
    },
    {
      "parameters": {
        "operation": "append",
        "sheetId": "={{$node[\"Google Sheets\"].parameter[\"sheetId\"]}}",
        "range": "Maisons!A1:J",
        "options": {}
      },
      "name": "Add Ads",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 1,
      "position": [
        1500,
        500
      ],
      "credentials": {
        "googleApi": "Google API"
      }
    },
    {
      "parameters": {
        "operation": "update",
        "sheetId": "={{$node[\"Add Ads\"].parameter[\"sheetId\"]}}",
        "range": "Maisons!A1:J",
        "key": "link",
        "options": {}
      },
      "name": "Update Ads",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 1,
      "position": [
        1950,
        150
      ],
      "credentials": {
        "googleApi": "Google API"
      }
    },
    {
      "parameters": {
        "functionCode": "return [{json: items.map(item => item['json']['link'])}];"
      },
      "name": "Links to Array",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        920,
        620
      ]
    },
    {
      "parameters": {
        "url": "={{$node[\"Split Ad Links\"].json[\"link\"]}}",
        "responseFormat": "string",
        "dataPropertyName": "ad_page",
        "options": {}
      },
      "name": "Retrieve ad HTML",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        840,
        300
      ]
    },
    {
      "parameters": {
        "dataPropertyName": "ad_page",
        "extractionValues": {
          "values": [
            {
              "key": "title",
              "cssSelector": "h1.entry-title:first-child"
            },
            {
              "key": "price",
              "cssSelector": ".price_area"
            },
            {
              "key": "description",
              "cssSelector": ".listing-content p",
              "returnArray": true
            },
            {
              "key": "department",
              "cssSelector": ".adres_area a:first-child"
            },
            {
              "key": "city",
              "cssSelector": ".adres_area a:last-child"
            },
            {
              "key": "photo_links",
              "cssSelector": "a.prettygalery",
              "returnValue": "attribute",
              "attribute": "href",
              "returnArray": true
            },
            {
              "key": "sold",
              "cssSelector": ".Vendu-par-nos-soins"
            }
          ]
        },
        "options": {}
      },
      "name": "Extract ad HTML",
      "type": "n8n-nodes-base.htmlExtract",
      "typeVersion": 1,
      "position": [
        960,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "const date = new Date()\nitem.description = item.description.join(\"\\n\");\nconst price = item.price.match(/(.+) €/)\nif (price) {\n  item.price = parseInt(price[1]) * 1000\n}\nconst department = item.department.match(/\\d+/)\nif (department) {\n  item.department = department[0]\n}\nitem.created_at = `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`\nitem.sold = item.sold && item.sold.includes('nos soins')\nreturn item;"
      },
      "name": "Format ad data",
      "type": "n8n-nodes-base.functionItem",
      "typeVersion": 1,
      "position": [
        1100,
        310
      ]
    },
    {
      "parameters": {
        "sheetId": "AZERTY1234",
        "range": "MaisonsURLS!A1:A9",
        "rawData": true,
        "options": {}
      },
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 1,
      "position": [
        -10,
        270
      ],
      "credentials": {
        "googleApi": "Google API"
      }
    },
    {
      "parameters": {
        "batchSize": 1,
        "options": {}
      },
      "name": "SplitInBatches",
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 1,
      "position": [
        270,
        270
      ]
    },
    {
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": true,
              "value2": "=={{$node[\"SplitInBatches\"].context[\"noItemsLeft\"]}}"
            }
          ]
        }
      },
      "name": "IF",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        770,
        -30
      ]
    },
    {
      "parameters": {
        "functionCode": "const existingLinks = $items(\"Links to Array\")[0]['json']\nconst filteredItems = items\n  .filter((item) => existingLinks.includes(item['json']['link']))\n  .map((item) => {\n    const { photo_links, created_at, ...rest } = item['json']\n    return { json: { ...rest, updated_at: new Date() } }\n  })\nreturn filteredItems"
      },
      "name": "Select Existing Ads",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        1370,
        350
      ]
    },
    {
      "parameters": {
        "functionCode": "const existingLinks = $items(\"Links to Array\")[0]['json']\nconst filteredItems = items.filter(item => !existingLinks.includes(item['json']['link']))\nreturn filteredItems\n"
      },
      "name": "Select New Ads",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        1370,
        500
      ]
    },
    {
      "parameters": {
        "triggerTimes": {
          "item": [
            {
              "mode": "everyHour"
            }
          ]
        }
      },
      "name": "Cron",
      "type": "n8n-nodes-base.cron",
      "typeVersion": 1,
      "position": [
        -200,
        460
      ]
    },
    {
      "parameters": {
        "fromEmail": "={{$node[\"Reference Email\"].parameter[\"fromEmail\"]}}",
        "toEmail": "={{$node[\"Reference Email\"].parameter[\"toEmail\"]}}",
        "subject": "Nouvelles Annonces Belles Maisons du Perche",
        "html": "=<h1>{{$node[\"Add Ads\"].json[\"title\"]}}</h1>\n<h4>{{$node[\"Add Ads\"].json[\"city\"]}}</h4>\n<h4>{{$node[\"Add Ads\"].json[\"price\"]}}\t€ </h4>\n<img src=\"{{$node[\"Add Ads\"].json[\"photo_links\"][0]}}\"/>\n<img src=\"{{$node[\"Add Ads\"].json[\"photo_links\"][1]}}\"/>\n<img src=\"{{$node[\"Add Ads\"].json[\"photo_links\"][2]}}\"/>\n<p>{{$node[\"Add Ads\"].json[\"description\"]}}</p>\n\n{{$node[\"Add Ads\"].json[\"link\"]}}",
        "options": {}
      },
      "name": "Send New Ad Email",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 1,
      "position": [
        1650,
        500
      ],
      "credentials": {
        "smtp": "Gmail SMTP"
      }
    },
    {
      "parameters": {
        "functionCode": "const newItems = [];\nitems[0]['json']['data'].map(item => {\n  newItems.push({json: {link: item[0]}});\n})\n\nreturn newItems;\n"
      },
      "name": "Split Page Links",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        120,
        270
      ]
    },
    {
      "parameters": {
        "functionCode": "const newItems = [];\nitems[0]['json']['ad_links'].map(item => {\n  newItems.push({json: {link: item}});\n})\n\nreturn newItems;\n"
      },
      "name": "Split Ad Links",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        700,
        420
      ]
    },
    {
      "parameters": {
        "conditions": {
          "number": [
            {
              "value1": "={{$node[\"Find Ad\"].json[\"price\"]}}",
              "operation": "notEqual",
              "value2": "={{$node[\"Select Existing Ads\"].json[\"price\"]}}"
            }
          ]
        }
      },
      "name": "IF1",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        1650,
        350
      ]
    },
    {
      "parameters": {
        "operation": "lookup",
        "sheetId": "={{$node[\"Google Sheets\"].parameter[\"sheetId\"]}}",
        "range": "Maisons!A1:J",
        "lookupColumn": "link",
        "lookupValue": "={{$node[\"Select Existing Ads\"].json[\"link\"]}}",
        "options": {}
      },
      "name": "Find Ad",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 1,
      "position": [
        1500,
        350
      ],
      "credentials": {
        "googleApi": "Google API"
      }
    },
    {
      "parameters": {
        "fromEmail": "={{$node[\"Reference Email\"].parameter[\"fromEmail\"]}}",
        "toEmail": "={{$node[\"Reference Email\"].parameter[\"toEmail\"]}}",
        "subject": "BellesMaisons - Price change!",
        "html": "=<h1>{{$node[\"Select Existing Ads\"].json[\"title\"]}}</h1>\n<img src=\"{{$node[\"Format ad data\"].json[\"photo_links\"][0]}}\" />\n<p>Ancien prix : {{$node[\"Find Ad\"].json[\"price\"]}}</p>\n<p>Nouveau prix : {{$node[\"Select Existing Ads\"].json[\"price\"]}}\t</p>\n<p>Vendue ? {{$node[\"Select Existing Ads\"].json[\"sold\"]}}</p>\n<br />\n{{$node[\"Select Existing Ads\"].json[\"link\"]}}",
        "options": {}
      },
      "name": "Send Email",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 1,
      "position": [
        1840,
        330
      ],
      "credentials": {
        "smtp": "Gmail SMTP"
      }
    },
    {
      "parameters": {
        "values": {
          "number": [
            {
              "name": "price",
              "value": "={{$node[\"Select Existing Ads\"].json[\"price\"]}}"
            }
          ]
        },
        "options": {}
      },
      "name": "Set",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        1800,
        150
      ]
    },
    {
      "parameters": {
        "fromEmail": "[email protected]",
        "toEmail": "[email protected],[email protected]",
        "options": {}
      },
      "name": "Reference Email",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 1,
      "position": [
        10,
        590
      ],
      "disabled": true
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Google Sheets",
            "type": "main",
            "index": 0
          },
          {
            "node": "Retrieve Existing Links",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "HTML Extract",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTML Extract": {
      "main": [
        [
          {
            "node": "Split Ad Links",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Select New Ads",
            "type": "main",
            "index": 0
          },
          {
            "node": "Select Existing Ads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Retrieve Existing Links": {
      "main": [
        [
          {
            "node": "Links to Array",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Retrieve ad HTML": {
      "main": [
        [
          {
            "node": "Extract ad HTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract ad HTML": {
      "main": [
        [
          {
            "node": "Format ad data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format ad data": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets": {
      "main": [
        [
          {
            "node": "Split Page Links",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SplitInBatches": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF": {
      "main": [
        [],
        [
          {
            "node": "SplitInBatches",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Select Existing Ads": {
      "main": [
        [
          {
            "node": "Find Ad",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Select New Ads": {
      "main": [
        [
          {
            "node": "Add Ads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add Ads": {
      "main": [
        [
          {
            "node": "Send New Ad Email",
            "type": "main",
            "index": 0
          },
          {
            "node": "IF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Cron": {
      "main": [
        [
          {
            "node": "Google Sheets",
            "type": "main",
            "index": 0
          },
          {
            "node": "Retrieve Existing Links",
            "type": "main",
            "index": 0
          },
          {
            "node": "Reference Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Page Links": {
      "main": [
        [
          {
            "node": "SplitInBatches",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Ad Links": {
      "main": [
        [
          {
            "node": "Retrieve ad HTML",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Find Ad": {
      "main": [
        [
          {
            "node": "IF1",
            "type": "main",
            "index": 0
          },
          {
            "node": "IF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF1": {
      "main": [
        [
          {
            "node": "Set",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set": {
      "main": [
        [
          {
            "node": "Update Ads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "timezone": "Europe/Paris"
  },
  "id": "9"
}
3 Likes

thank you for this!!!