{
  "name": "Extract expenses from emails and add to Google Sheet",
  "nodes": [
    {
      "name": "Check subject",
      "type": "n8n-nodes-base.if",
      "position": [
        800,
        300
      ],
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{$json[\"subject\"].toLowerCase()}}",
              "value2": "=/{{$json[\"subjectPatterns\"].toLowerCase()}}/",
              "operation": "regex"
            }
          ]
        },
        "combineOperation": "any"
      },
      "typeVersion": 1
    },
    {
      "name": "Setup Variables",
      "type": "n8n-nodes-base.set",
      "position": [
        620,
        300
      ],
      "parameters": {
        "values": {
          "string": [
            {
              "name": "subjectPatterns",
              "value": "(expenses|reciept)"
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "name": "Check for new emails",
      "type": "n8n-nodes-base.emailReadImap",
      "position": [
        440,
        300
      ],
      "parameters": {
        "format": "resolved",
        "mailbox": "Inbox",
        "options": {
          "allowUnauthorizedCerts": true
        }
      },
      "typeVersion": 1
    },
    {
      "name": "Read Receipts",
      "type": "n8n-nodes-base.mindee",
      "position": [
        1020,
        280
      ],
      "parameters": {
        "binaryPropertyName": "attachment_0"
      },
      "typeVersion": 1
    },
    {
      "name": "Set column data",
      "type": "n8n-nodes-base.set",
      "position": [
        1200,
        280
      ],
      "parameters": {
        "values": {
          "string": [
            {
              "name": "Date",
              "value": "={{$json[\"date\"]}}"
            },
            {
              "name": "Description",
              "value": "={{$node[\"Check for new emails\"].json[\"subject\"].split(\"-\")[1]}}"
            },
            {
              "name": "Category",
              "value": "={{$json[\"category\"]}}"
            },
            {
              "name": "Currency",
              "value": "={{$json[\"currency\"]}}"
            },
            {
              "name": "Amount",
              "value": "={{$json[\"total\"]}}"
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "name": "Add to Google Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1380,
        280
      ],
      "parameters": {
        "range": "A:E",
        "options": {},
        "sheetId": "REPLACE_WITH_SHEETID",
        "operation": "append",
        "authentication": "oAuth2"
      },
      "typeVersion": 1
    },
    {
      "id": "8ea40774-99aa-597f-ad93-de2bea7761b7",
      "name": "Publication · Overview and setup",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -800,
        0
      ],
      "parameters": {
        "content": "# Extract expenses from emails and add to Google Sheet\n\n## Purpose and structure\nThis folder contains the **Extract expenses from emails and add to Google Sheet** workflow. Its executable nodes use `emailReadImap`, `googleSheets`, `if`, `mindee`, `set`. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.\n\n## Setup\nImport inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.\n\n## Entry points\nInspect connections; no recognized trigger.\n\n## Verification\nSanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.\n\n## Attribution\nhttps://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Googlesheets/1188_GoogleSheets_Emailreadimap_Create.json\nMIT; preserve source notices.",
        "width": 700,
        "height": 800,
        "color": 1
      }
    }
  ],
  "active": false,
  "settings": {},
  "connections": {
    "Check subject": {
      "main": [
        [
          {
            "node": "Read Receipts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Receipts": {
      "main": [
        [
          {
            "node": "Set column data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set column data": {
      "main": [
        [
          {
            "node": "Add to Google Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Setup Variables": {
      "main": [
        [
          {
            "node": "Check subject",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check for new emails": {
      "main": [
        [
          {
            "node": "Setup Variables",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
