image.png

n8n-Workflow

{
  "name": "Competitor Analysis Multi-Sheet",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 24
            }
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.1,
      "position": [
        16,
        -176
      ],
      "id": "7aaf24da-f69b-47ac-aee4-ba8a375a8015",
      "name": "Daily Trigger"
    },
    {
      "parameters": {
        "jsCode": "// Konfiguration der Wettbewerber\n// Wir definieren hier URL und den Namen der Spalte im Google Sheet\n\nconst competitors = [\n{\n    \"name\": \"Beispiel_Shop\",\n    \"url\": \"<https://www.beispiel-shop.de/\>",\n    \"sheetColumn\": \"Beispiel_Shop\"\n  }\n];\n\n\n// Datum formatieren für das Sheet (DD.MM.YYYY)\nconst date = new Date();\nconst formattedDate = date.toLocaleDateString('de-DE', {\n  day: '2-digit',\n  month: '2-digit',\n  year: 'numeric'\n});\n\n// Wir geben für jeden Wettbewerber ein Item zurück\nreturn competitors.map(comp => {\n  return {\n    json: {\n      ...comp,\n      lookupDate: formattedDate // Das Datum nutzen wir, um die Zeile zu finden\n    }\n  }\n});"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        240,
        -176
      ],
      "id": "fa4ea8f5-8c28-4cee-8f3a-5e7ffb38d6c5",
      "name": "Define Competitors"
    },
    {
      "parameters": {
        "url": "<https://proxy.scrapeops.io/v1/>",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "api_key",
              "value": "DEIN_SCRAPEOPS_API_KEY_HIER"
            },
            {
              "name": "url",
              "value": "={{ $json.url }}"
            },
            {
              "name": "render_js",
              "value": "true"
            },
            {
              "name": "screenshot",
              "value": "true"
            },
            {
              "name": "json_response",
              "value": "true"
            }
          ]
        },
        "options": {
          "response": {
            "response": {}
          },
          "timeout": 120000
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        464,
        -176
      ],
      "id": "9611cc94-19c9-46a5-9d76-1e3bdcfea339",
      "name": "Scrape Website"
    },
    {
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "const base64String = $input.item.json.screenshot;\n\nreturn {\n  json: $input.item.json, \n  binary: {\n    screenshot: {\n      data: base64String,\n      mimeType: 'image/png',\n      fileName: 'captured_screenshot.png'\n    }\n  }\n};"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        688,
        -176
      ],
      "id": "40df3457-cfea-4de1-9c5b-4d93e91d21f4",
      "name": "Convert Binary"
    },
    {
      "parameters": {
        "resource": "image",
        "operation": "analyze",
        "modelId": {
          "__rl": true,
          "value": "models/gemini-2.5-flash",
          "mode": "list",
          "cachedResultName": "models/gemini-2.5-flash"
        },
        "text": "Analyze this screenshot. Determine if there is currently an active sale.\n\nOutput ONLY plain text summary suitable for a spreadsheet cell. Keep it concise.\n\nFormat:\nSale Active: Yes/No\nDetails: [Key offer details like % off or code]",
        "inputType": "binary",
        "binaryPropertyName": "screenshot",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "typeVersion": 1.1,
      "position": [
        912,
        -176
      ],
      "id": "a1aae8a3-f92d-4fda-a473-c107e7b13297",
      "name": "Analyze with Gemini",
      "credentials": {
        "googlePalmApi": {
          "id": "DEINE_GEMINI_CREDENTIAL_ID_HIER",
          "name": "Google Gemini Api"
        }
      }
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "DEINE_SHEET_ID_HIER",
          "mode": "list",
          "cachedResultName": "Dein Sale Notes Sheet",
          "cachedResultUrl": "<https://docs.google.com/spreadsheets/d/DEINE_SHEET_ID_HIER/edit?usp=drivesdk>"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Competitors",
          "cachedResultUrl": "<https://docs.google.com/spreadsheets/d/DEINE_SHEET_ID_HIER/edit#gid=0>"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Date": "={{ $('Define Competitors').item.json.lookupDate }}",
            "Competitor": "={{ $('Define Competitors').item.json.sheetColumn }}",
            "Result": "={{ $json.content.parts[0].text }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "Date",
              "displayName": "Date",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Competitor",
              "displayName": "Competitor",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Result",
              "displayName": "Result",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        1184,
        -176
      ],
      "id": "24fa3f39-2a5a-4847-aeb6-3a5c7bc4290c",
      "name": "Update Google Sheet",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "DEINE_GSHEETS_CREDENTIAL_ID_HIER",
          "name": "Google Sheets account"
        }
      }
    }
  ],
  "pinData": {},
  "connections": {
    "Daily Trigger": {
      "main": [
        [
          {
            "node": "Define Competitors",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Define Competitors": {
      "main": [
        [
          {
            "node": "Scrape Website",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scrape Website": {
      "main": [
        [
          {
            "node": "Convert Binary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert Binary": {
      "main": [
        [
          {
            "node": "Analyze with Gemini",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze with Gemini": {
      "main": [
        [
          {
            "node": "Update Google Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "availableInMCP": false
  },
  "versionId": "PLATZHALTER_VERSION_ID",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "DEINE_N8N_INSTANCE_ID_HIER"
  },
  "id": "PLATZHALTER_WORKFLOW_ID",
  "tags": []
}