{
  "nodes": [
    {
      "id": "a1b2c3d4-0001-4000-8000-000000000001",
      "name": "Run Manually",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        2736,
        1040
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "daee4978-ab23-479d-a481-2731cdda3256",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3424,
        864
      ],
      "parameters": {
        "color": 7,
        "height": 336,
        "content": "## Store in Google Sheets\n\nThe final output step that writes the formatted property data into Google Sheets."
      },
      "typeVersion": 1
    },
    {
      "id": "a5e62e93-d56c-40c0-a27b-1e260957cd88",
      "name": "Fetch Idealista Listings",
      "type": "n8n-nodes-idealista-scraper.idealistaScraper",
      "position": [
        2992,
        1040
      ],
      "parameters": {
        "numPages": 2,
        "operation": "sale",
        "sizeFilters": {},
        "priceFilters": {
          "maxPrice": 500000
        },
        "rentalFilters": {},
        "featureFilters": {},
        "advancedFilters": {},
        "conditionFilters": {},
        "floorTimeFilters": {},
        "propertyTypeFilters": {},
        "bedroomBathroomFilters": {
          "bedrooms2": true,
          "bedrooms3": true
        }
      },
      "typeVersion": 1
    },
    {
      "id": "8e5cf5fa-1bd2-4662-998a-8fbb36bbe9fa",
      "name": "Prepare Property Data",
      "type": "n8n-nodes-base.code",
      "position": [
        3248,
        1040
      ],
      "parameters": {
        "jsCode": "// Format Idealista property data into clean spreadsheet columns\n// Customize: add or remove fields to match your needs\n\nreturn $input.all().map(item => {\n  const p = item.json;\n  return {\n    json: {\n      title: p.title || '',\n      price: p.price || '',\n      pricePerM2: p.priceByArea || p.unitPrice || '',\n      size: p.size || '',\n      rooms: p.rooms || '',\n      bathrooms: p.bathrooms || '',\n      floor: p.floor || '',\n      address: p.address || '',\n      neighborhood: p.neighborhood || '',\n      district: p.district || '',\n      municipality: p.municipality || '',\n      province: p.province || '',\n      latitude: p.latitude || '',\n      longitude: p.longitude || '',\n      propertyType: p.propertyType || '',\n      description: (p.description || '').substring(0, 500),\n      hasElevator: p.hasLift || false,\n      hasParking: p.hasParkingSpace || false,\n      hasSwimmingPool: p.hasSwimmingPool || false,\n      hasTerrace: p.hasTerrace || false,\n      hasGarden: p.hasGarden || false,\n      hasAirConditioning: p.hasAirConditioning || false,\n      isNewDevelopment: p.newDevelopment || false,\n      agencyName: p.contactName || '',\n      agencyPhone: p.contactPhone || '',\n      url: p.url || '',\n      thumbnail: p.thumbnail || '',\n      numPhotos: p.numPhotos || 0,\n      scrapedAt: new Date().toISOString()\n    }\n  };\n});"
      },
      "typeVersion": 2
    },
    {
      "id": "2a2b28c6-0d87-4fc5-8db3-6392db462685",
      "name": "Append Properties in Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        3472,
        1040
      ],
      "parameters": {
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "19e2529c-e023-4a57-8d7a-d135f6db8e4e",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2096,
        864
      ],
      "parameters": {
        "width": 480,
        "height": 768,
        "content": "## Untitled workflow\n\n### How it works\n\n1. The workflow starts manually when the user triggers it.\n2. It scrapes Idealista property listings from the configured source.\n3. It formats the scraped property data into clean spreadsheet columns.\n4. It saves the structured results into Google Sheets.\n\n### Setup steps\n\n- [ ] Connect the Idealista scraping node to the target listings source and confirm any search filters or scraping parameters.\n- [ ] Set up Google Sheets credentials and grant access to the destination spreadsheet.\n- [ ] Choose or create the target spreadsheet and worksheet/tab for storing the listings.\n- [ ] Verify the code formatting step matches the desired column names and data shape before writing to Sheets.\n\n### Customization\n\nAdjust the scraper query, output columns, and Google Sheets destination tab to match the property data you want to collect."
      },
      "typeVersion": 1
    },
    {
      "id": "3dd6097e-92be-4baa-9215-e051f6a47f9c",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2656,
        880
      ],
      "parameters": {
        "color": 7,
        "height": 320,
        "content": "## Manual workflow start\n\nA small entry-point cluster that begins the workflow when run manually."
      },
      "typeVersion": 1
    },
    {
      "id": "a975f561-356d-44b5-8694-6c88e9a9a3ce",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2944,
        880
      ],
      "parameters": {
        "color": 7,
        "width": 448,
        "height": 320,
        "content": "## Scrape and format listings\n\nThe central processing cluster that pulls Idealista listings and cleans the data into spreadsheet-ready fields."
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Run Manually": {
      "main": [
        [
          {
            "node": "Fetch Idealista Listings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Property Data": {
      "main": [
        [
          {
            "node": "Append Properties in Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Idealista Listings": {
      "main": [
        [
          {
            "node": "Prepare Property Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}