{
  "name": "Send weekly AI summaries of Google Sheets data via Gmail using OpenAI",
  "nodes": [
    {
      "id": "e4b864f9-60a5-47f8-a7c0-7b9cd0f7e963",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        32,
        208
      ]
    },
    {
      "id": "6d5cdac8-9819-4552-a5b7-4877d5e55165",
      "name": "Read Google Sheets Data",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        240,
        208
      ]
    },
    {
      "id": "e37c6193-05d7-406c-8fc0-c13604c629a5",
      "name": "Aggregate Rows",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        464,
        208
      ]
    },
    {
      "id": "fc737428-ddbc-4ec0-aca8-419b31cc8945",
      "name": "Generate Summary with AI",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        688,
        208
      ]
    },
    {
      "id": "405f5a97-32d5-4948-a0a9-3c82f551050c",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        688,
        384
      ]
    },
    {
      "id": "3c7a8673-c627-47cc-af66-5cdb45f0b20c",
      "name": "Format Report",
      "type": "n8n-nodes-base.set",
      "position": [
        960,
        208
      ]
    },
    {
      "id": "f29d7344-f753-4cd8-b714-841fa1f269e6",
      "name": "Send Report Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1152,
        208
      ]
    },
    {
      "id": "9509f8bd-06f4-4b1e-b876-f6171e8b9a0a",
      "name": "Log Report Sent",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1344,
        208
      ]
    },
    {
      "id": "b7d1527b-6d16-422d-87a5-49ff46547b79",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -592,
        32
      ],
      "parameters": {
        "width": 580,
        "height": 484,
        "content": "## How it works\n\nThis workflow runs automatically every Monday at 9am. It reads data from a Google Sheets spreadsheet, aggregates all the rows into a single payload, and sends it to OpenAI to generate"
      }
    },
    {
      "id": "5d657543-990b-44c4-b7c7-dc015ee3af1e",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        48,
        96
      ],
      "parameters": {
        "width": 460,
        "height": 96,
        "content": "## Schedule & Read\nRuns every Monday at 9am, reads all rows from the data spreadsheet, and aggregates them."
      }
    },
    {
      "id": "c04fe2b1-e2f3-4e15-93e3-f5053a3e2651",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        736,
        64
      ],
      "parameters": {
        "width": 500,
        "height": 112,
        "content": "## Summarize, Send & Log\nAI generates a summary report, emails it via Gmail, and logs the send to a separate spreadsheet."
      }
    }
  ],
  "connections": {
    "Format Report": {
      "main": [
        [
          {
            "node": "Send Report Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate Rows": {
      "main": [
        [
          {
            "node": "Generate Summary with AI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Read Google Sheets Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Summary with AI",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Send Report Email": {
      "main": [
        [
          {
            "node": "Log Report Sent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Google Sheets Data": {
      "main": [
        [
          {
            "node": "Aggregate Rows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Summary with AI": {
      "main": [
        [
          {
            "node": "Format Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}