{
  "id": "XauJCnQcPdG8IWr2",
  "name": "Job Offers Extractor \u2192 Google Sheets",
  "tags": [],
  "nodes": [
    {
      "id": "a8279960-2356-4aae-a005-0bf0626622d6",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "width": 520,
        "height": 1016,
        "content": "## Job Offers Extractor \u2192 Google Sheets\n\n### How it works\n\nThis workflow runs daily and reads a list of careers-page URLs from a Google Sheet. For each URL, it captures the fully-rendered page HTML with Snapshot Site, cleans it, and passes it to an AI Information Extractor that pulls out structured job listing fields. Extracted jobs are appended to a results sheet (deduplicated by application URL); comparison failures are logged to an errors sheet instead of stopping the run.\n\n### Setup steps\n\n- Install the `n8n-nodes-snapshot-site` community node (Settings \u2192 Community nodes \u2192 Install \u2192 `n8n-nodes-snapshot-site`) \u2014 verified by n8n.\n- Add a Snapshot Site credential, a Google Sheets credential, and an AI chat model credential (e.g. OpenAI) for the Information Extractor.\n- Create a source sheet with a `url` column (one careers page per row) and a results sheet with columns matching the extracted fields (see the workflow README for the full list).\n- Paste this exact header row into row 1 of the **Job Offers** tab (tab-separated, one column per cell): `jobTitle\tcompany\tlocation\tcountry\temploymentType\tworkMode\tsalary\texperienceLevel\tskills\tpublicationDate\tapplicationUrl\tsummary`\n- Paste this header row into row 1 of the **Extraction Errors** tab: `url\tmessage\toccurredAt`\n- After importing, open the two Google Sheets write nodes (Log Extraction Error, Save Job Offers) and switch Mapping Column Mode from \"Map Each Column Manually\" to \"Map Automatically\" \u2014 it always imports blank regardless of the JSON, but since the sheet headers above already match the incoming field names, this needs no manual typing.\n- Point the two Google Sheets nodes at your spreadsheet and adjust the schedule.\n\n### Customization\n\nAdd more source columns (e.g. a `category` tag), swap the AI model, or point the same Clean HTML \u2192 Extractor pattern at a different page type \u2014 this is the base pattern for every extraction workflow in this collection."
      },
      "typeVersion": 1
    },
    {
      "id": "5192210c-407e-41e6-a319-4d1647d3d70c",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        528,
        224
      ],
      "parameters": {
        "color": 7,
        "width": 820,
        "height": 380,
        "content": "## Read sources and loop\n\nReads every careers page URL from the source sheet and processes them one at a time."
      },
      "typeVersion": 1
    },
    {
      "id": "28a65673-529a-49c1-86e9-49e59a51ba59",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1392,
        112
      ],
      "parameters": {
        "color": 7,
        "width": 780,
        "height": 800,
        "content": "## Capture and clean\n\nCaptures the fully-rendered HTML, checks for API errors, and strips scripts/styles before the AI step."
      },
      "typeVersion": 1
    },
    {
      "id": "1507ae7d-dd33-483a-ad15-d4bcd7a9cc06",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2224,
        224
      ],
      "parameters": {
        "color": 7,
        "width": 780,
        "height": 600,
        "content": "## Extract and save\n\nExtracts structured job fields with AI, splits the array into individual rows, and appends them to the results sheet."
      },
      "typeVersion": 1
    },
    {
      "id": "1d0e33df-d987-435f-b3b0-0e4080a0d32a",
      "name": "When Every Day at 9AM",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        608,
        464
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 9
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "fffb8894-b440-4075-9a84-e759415adcd9",
      "name": "Read Job Sources",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        880,
        464
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Job Sources"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": "https://docs.google.com/spreadsheets/d/PLACEHOLDER/edit"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "19a0f581-6627-4f8c-8617-0205df3137b5",
      "name": "Loop Over Job Sources",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1168,
        464
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "dbc3e336-003f-44e4-8db0-31c3898db989",
      "name": "All Sources Processed",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1440,
        304
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "ea2cf991-0666-455c-868d-249fe1b7c17e",
      "name": "Get Page HTML",
      "type": "n8n-nodes-snapshot-site.snapshotSite",
      "onError": "continueErrorOutput",
      "maxTries": 3,
      "position": [
        1440,
        544
      ],
      "parameters": {
        "url": "={{ $json.url }}",
        "requestOptions": {},
        "additionalFields": {
          "delay": 5,
          "format": "html"
        }
      },
      "retryOnFail": true,
      "typeVersion": 1,
      "waitBetweenTries": 5000
    },
    {
      "id": "ac953a5e-b2dc-4583-83e2-7a7ea235cd27",
      "name": "Check for API Error",
      "type": "n8n-nodes-base.if",
      "position": [
        1728,
        544
      ],
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": "={{ $json.error === true }}",
              "value2": true
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "56a3191a-b480-4b83-94ca-2f5910837da1",
      "name": "Build Error Record",
      "type": "n8n-nodes-base.set",
      "position": [
        1728,
        752
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "name": "url",
              "type": "string",
              "value": "={{ $('Loop Over Job Sources').item.json.url }}"
            },
            {
              "name": "message",
              "type": "string",
              "value": "={{ $json.error?.message || $json.message }}"
            },
            {
              "name": "occurredAt",
              "type": "string",
              "value": "={{ $now.toISO() }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "a55c8f13-d1e2-4797-8d74-4454e87c14f0",
      "name": "Log Extraction Error",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2000,
        752
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [],
          "mappingMode": "autoMapInputData",
          "matchingColumns": []
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Extraction Errors"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": "https://docs.google.com/spreadsheets/d/PLACEHOLDER/edit"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "0ef5d54a-faae-4cc1-9c46-dfd3c998e24c",
      "name": "Clean HTML",
      "type": "n8n-nodes-base.code",
      "position": [
        2000,
        464
      ],
      "parameters": {
        "jsCode": "const MAX_CHARS = 100000;\nconst raw = $input.item.json.html || '';\nlet cleaned = raw\n  .replace(/<script[\\s\\S]*?<\\/script>/gi, '')\n  .replace(/<style[\\s\\S]*?<\\/style>/gi, '')\n  .replace(/<svg[\\s\\S]*?<\\/svg>/gi, '')\n  .replace(/<!--[\\s\\S]*?-->/g, '')\n  .replace(/\\s+/g, ' ')\n  .trim();\nif (cleaned.length > MAX_CHARS) {\n  cleaned = cleaned.slice(0, MAX_CHARS);\n}\nreturn [{ json: { url: $input.item.json.url, cleanedHtml: cleaned } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "8fb025cf-5453-45d5-a587-8ded9b1d5c52",
      "name": "Extract Job Fields",
      "type": "@n8n/n8n-nodes-langchain.informationExtractor",
      "position": [
        2288,
        464
      ],
      "parameters": {
        "text": "={{ $json.cleanedHtml }}",
        "options": {},
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"jobs\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"object\",\n        \"properties\": {\n          \"jobTitle\": { \"type\": \"string\" },\n          \"company\": { \"type\": \"string\" },\n          \"location\": { \"type\": \"string\" },\n          \"country\": { \"type\": \"string\" },\n          \"employmentType\": { \"type\": \"string\" },\n          \"workMode\": { \"type\": \"string\", \"description\": \"Remote, Hybrid, or On-site\" },\n          \"salary\": { \"type\": \"string\" },\n          \"experienceLevel\": { \"type\": \"string\" },\n          \"skills\": { \"type\": \"string\" },\n          \"publicationDate\": { \"type\": \"string\" },\n          \"applicationUrl\": { \"type\": \"string\" },\n          \"summary\": { \"type\": \"string\" }\n        }\n      }\n    }\n  }\n}"
      },
      "typeVersion": 1
    },
    {
      "id": "5faf3196-d504-4a1c-a2f7-e78c39ef6544",
      "name": "Extraction Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        2288,
        672
      ],
      "parameters": {
        "model": "gpt-4o-mini",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "e25d51ed-83ec-4bc6-9663-dcebe6efc8c5",
      "name": "Split Job Offers",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        2560,
        464
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "output.jobs"
      },
      "typeVersion": 1
    },
    {
      "id": "b871f7e5-bad0-44f4-8265-ab6a6ae0536d",
      "name": "Save Job Offers",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2848,
        464
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [
            "applicationUrl"
          ]
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Job Offers"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": "https://docs.google.com/spreadsheets/d/PLACEHOLDER/edit"
        }
      },
      "typeVersion": 4.5
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "executionOrder": "v1"
  },
  "versionId": "b3d58b5a-ca2f-4ae4-b648-138bed03710f",
  "nodeGroups": [],
  "connections": {
    "Clean HTML": {
      "main": [
        [
          {
            "node": "Extract Job Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Page HTML": {
      "main": [
        [
          {
            "node": "Check for API Error",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Build Error Record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Job Offers": {
      "main": [
        [
          {
            "node": "Loop Over Job Sources",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extraction Model": {
      "ai_languageModel": [
        [
          {
            "node": "Extract Job Fields",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Read Job Sources": {
      "main": [
        [
          {
            "node": "Loop Over Job Sources",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Job Offers": {
      "main": [
        [
          {
            "node": "Save Job Offers",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Error Record": {
      "main": [
        [
          {
            "node": "Log Extraction Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Job Fields": {
      "main": [
        [
          {
            "node": "Split Job Offers",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check for API Error": {
      "main": [
        [
          {
            "node": "Build Error Record",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Clean HTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log Extraction Error": {
      "main": [
        [
          {
            "node": "Loop Over Job Sources",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Job Sources": {
      "main": [
        [
          {
            "node": "All Sources Processed",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Page HTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Every Day at 9AM": {
      "main": [
        [
          {
            "node": "Read Job Sources",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}