{
  "name": "Log new Gmail messages automatically in Google Sheets",
  "nodes": [
    {
      "id": "ab1b7d2d-7eac-45eb-9e0a-36f14c56df14",
      "name": "When clicking ‘Execute workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -592,
        -944
      ]
    },
    {
      "id": "be31a0f1-8b41-48ea-b80b-cf3de29df733",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1088,
        -1536
      ],
      "parameters": {
        "width": 400,
        "height": 1056,
        "content": "\n## ⚙️ Setup Instructions\n\n### 1️⃣ Connect Gmail\n1. In **n8n → Credentials → New → Gmail OAuth2**  \n2. Log in with your Gmail account & approve access  \n3. Attach this credential to the **Get new mess"
      }
    },
    {
      "id": "1d6e32b0-92fe-4473-a207-e895e66b79e2",
      "name": "Sticky Note52",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        -1296
      ],
      "parameters": {
        "width": 224,
        "height": 336,
        "content": "### 1️⃣ Connect Gmail\n1. In **n8n → Credentials → New → Gmail OAuth2**  \n2. Log in with your Gmail account & approve access  \n3. Attach this credential to the **Get new messages** node in the workflow"
      }
    },
    {
      "id": "4f9c9dd4-6a32-4175-bde4-59224486c5ac",
      "name": "Sticky Note50",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        -1536
      ],
      "parameters": {
        "width": 1392,
        "height": 1056,
        "content": "# 📋 Track Gmail Messages in Google Sheets with Automated Logging\n\nThis workflow automatically **fetches new Gmail messages since the last run** and appends them into a **Google Sheet** with their ID, "
      }
    },
    {
      "id": "0ba209c5-f532-4a98-a60d-2c3867b7890f",
      "name": "Sticky Note54",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        432,
        -992
      ],
      "parameters": {
        "width": 288,
        "height": 368,
        "content": "\n### 2️⃣ Connect Google Sheets\n1. Copy this [Google Sheet template](https://docs.google.com/spreadsheets/d/1t5VXtbo9g7SvGDPmeZok4HG1K-WI1PS0DNBylzmhVwg/edit?usp=drivesdk) into your own Drive  \n2. In *"
      }
    },
    {
      "id": "89e5ccfd-b798-427d-a3fb-e1c71e408076",
      "name": "Add Emails to Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        544,
        -752
      ]
    },
    {
      "id": "7fed2ca3-3b0e-4cd9-89e1-364e21e1e67d",
      "name": "Get Todays Date",
      "type": "n8n-nodes-base.code",
      "position": [
        -176,
        -848
      ]
    },
    {
      "id": "57a1dc13-b00a-496c-b121-1b56444fc878",
      "name": "Get Current Emails",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -416,
        -1104
      ]
    },
    {
      "id": "7a474f8f-7ca2-4c91-aff3-b69ecce19677",
      "name": "Get Max Date",
      "type": "n8n-nodes-base.summarize",
      "position": [
        -96,
        -1216
      ]
    },
    {
      "id": "0a1d33af-d580-4753-af4c-aba65f7c623f",
      "name": "Combine",
      "type": "n8n-nodes-base.merge",
      "position": [
        272,
        -1264
      ]
    },
    {
      "id": "2bc48807-0c03-4cac-ad18-60b99e7dc6aa",
      "name": "Get new messages",
      "type": "n8n-nodes-base.gmail",
      "position": [
        272,
        -976
      ]
    }
  ],
  "connections": {
    "Combine": {
      "main": [
        [
          {
            "node": "Get new messages",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Max Date": {
      "main": [
        [
          {
            "node": "Combine",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Todays Date": {
      "main": [
        [
          {
            "node": "Combine",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Get new messages": {
      "main": [
        [
          {
            "node": "Add Emails to Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Current Emails": {
      "main": [
        [
          {
            "node": "Get Max Date",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add Emails to Sheets": {
      "main": [
        []
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Get Todays Date",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get Current Emails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}