{
  "name": "Monitor SQL data quality and send email reports with Google Sheets logging",
  "nodes": [
    {
      "id": "52fa31e9-1811-4999-8254-4516e56610e7",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        112,
        400
      ]
    },
    {
      "id": "8db194eb-88ae-4ff5-bee9-46da8c912288",
      "name": "Config",
      "type": "n8n-nodes-base.set",
      "position": [
        336,
        400
      ]
    },
    {
      "id": "d809a9c0-0dd8-45b8-be46-91132ecb234c",
      "name": "Null Check",
      "type": "n8n-nodes-base.postgres",
      "position": [
        560,
        112
      ]
    },
    {
      "id": "bbf08a47-ce4b-49fa-8557-1227f6b30dd6",
      "name": "Duplicate Check",
      "type": "n8n-nodes-base.postgres",
      "position": [
        560,
        304
      ]
    },
    {
      "id": "4ec88710-8d0b-480a-8239-ed25e0d118c6",
      "name": "Row Count",
      "type": "n8n-nodes-base.postgres",
      "position": [
        560,
        496
      ]
    },
    {
      "id": "f3d04639-05a9-4b69-ba7c-87ac6d9fafc2",
      "name": "Outlier Check",
      "type": "n8n-nodes-base.postgres",
      "position": [
        560,
        688
      ]
    },
    {
      "id": "cea373b4-c913-4d9f-b566-90b9ddb35879",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        832,
        352
      ]
    },
    {
      "id": "0b323db9-8b30-453b-a396-ca74ce1b0308",
      "name": "Evaluate & Format",
      "type": "n8n-nodes-base.code",
      "position": [
        1008,
        400
      ]
    },
    {
      "id": "f678cd51-4d24-4318-993d-2795fad9bce4",
      "name": "Log to Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1232,
        496
      ]
    },
    {
      "id": "51ba3e03-248d-4e7a-8df2-7c11a3a4eca5",
      "name": "Send a message",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1232,
        304
      ]
    },
    {
      "id": "80b53380-1912-4945-add4-4e4d976bad67",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -672,
        16
      ],
      "parameters": {
        "width": 528,
        "height": 976,
        "content": "📊 Automated Data Quality Report Bot\n\nThis workflow automatically monitors data quality for a selected database table and generates a structured report with actionable insights. It performs four key ch"
      }
    },
    {
      "id": "ebb0c98d-0995-40e4-b753-87b683c4230c",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        48,
        272
      ],
      "parameters": {
        "width": 400,
        "height": 288,
        "content": "⏰ Trigger & Configuration\n\nControls workflow execution and defines all dynamic inputs like table name, columns, thresholds, and email recipients."
      }
    },
    {
      "id": "a0e34fa9-e962-4c7d-ad42-45e9be249169",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        -80
      ],
      "parameters": {
        "width": null,
        "height": 928,
        "content": "🧪 Data Quality Checks (SQL)\n\nRuns four parallel checks:\n\nNull values\nDuplicate records\nRow count validation\nOutlier detection"
      }
    },
    {
      "id": "c0b454bc-1fb1-4af2-8ba1-96c351d98402",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        768,
        192
      ],
      "parameters": {
        "width": 160,
        "height": 416,
        "content": "🔗 Merge Results\n\nCombines outputs from all SQL checks into a single dataset for evaluation."
      }
    },
    {
      "id": "933b2425-3eb3-4821-91e3-f53719cd0ba1",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        976,
        176
      ],
      "parameters": {
        "width": 160,
        "height": 352,
        "content": "🧠 Evaluate & Format Report\n\nApplies threshold logic (PASS/WARN/FAIL) and generates a clean HTML report with status indicators."
      }
    },
    {
      "id": "26018a1a-1fb3-4c75-9665-71e11095d902",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1168,
        144
      ],
      "parameters": {
        "width": null,
        "height": 528,
        "content": "📤 Output & Notifications\n\nSends report via email and logs results into Google Sheets for tracking and auditing."
      }
    },
    {
      "id": "e33474a1-3dfb-45a3-ae4f-8cc71850f245",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        288,
        384
      ],
      "parameters": {
        "width": 192,
        "height": 368,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n⚠️ Critical Setup\n\nEnsure all column names in the Config node match your database schema exactly. Incorrect names will break SQL queries."
      }
    }
  ],
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Evaluate & Format",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Config": {
      "main": [
        [
          {
            "node": "Null Check",
            "type": "main",
            "index": 0
          },
          {
            "node": "Duplicate Check",
            "type": "main",
            "index": 0
          },
          {
            "node": "Row Count",
            "type": "main",
            "index": 0
          },
          {
            "node": "Outlier Check",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Row Count": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 3
          }
        ]
      ]
    },
    "Null Check": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Outlier Check": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 4
          }
        ]
      ]
    },
    "Duplicate Check": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Evaluate & Format": {
      "main": [
        [
          {
            "node": "Log to Google Sheets",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}