{
  "name": "Gmail to Google Sheets starter",
  "nodes": [
    {
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "filters": {
          "labelIds": [
            "REPLACE_WITH_LABEL_ID"
          ]
        }
      },
      "id": "GmailTrigger",
      "name": "Gmail Trigger",
      "type": "n8n-nodes-base.gmailTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ],
      "credentials": {
        "gmailOAuth2": {
          "id": "REPLACE_WITH_CREDENTIAL_ID",
          "name": "REPLACE_WITH_GMAIL_CREDENTIAL"
        }
      }
    },
    {
      "parameters": {
        "keepOnlySet": true,
        "values": {
          "string": [
            {
              "name": "message_id",
              "value": "={{$json.id}}"
            },
            {
              "name": "from",
              "value": "={{$json.from || $json.headers?.from || \"\"}}"
            },
            {
              "name": "subject",
              "value": "={{$json.subject || \"\"}}"
            },
            {
              "name": "received_at",
              "value": "={{$json.date || $now}}"
            }
          ]
        }
      },
      "id": "SetRow",
      "name": "Set row fields",
      "type": "n8n-nodes-base.set",
      "typeVersion": 2,
      "position": [
        240,
        0
      ]
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": "REPLACE_WITH_SPREADSHEET_ID",
        "sheetName": "REPLACE_WITH_SHEET_NAME",
        "columns": {
          "mappingMode": "autoMapInputData"
        }
      },
      "id": "Sheets",
      "name": "Append row",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4,
      "position": [
        480,
        0
      ],
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "REPLACE_WITH_CREDENTIAL_ID",
          "name": "REPLACE_WITH_GOOGLE_SHEETS_CREDENTIAL"
        }
      }
    }
  ],
  "connections": {
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "Set row fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set row fields": {
      "main": [
        [
          {
            "node": "Append row",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "active": false,
  "pinData": {},
  "versionId": "replace-after-import"
}
