{
  "name": "Automated invoice processing & filing with IMAP, AI, Google Drive & DateV",
  "nodes": [
    {
      "id": "00537f01-be79-4aa1-b162-e428b9dbd8f2",
      "name": "Extract From PDF",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        1232,
        -528
      ]
    },
    {
      "id": "653108bc-f685-47c4-9d81-3f71b022df52",
      "name": "Extract & Format Data",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1424,
        -528
      ]
    },
    {
      "id": "fd51efcc-6ed9-4012-8318-8ceee8bc524d",
      "name": "Get Additional Date Data",
      "type": "n8n-nodes-base.code",
      "position": [
        1776,
        -528
      ]
    },
    {
      "id": "b2509ccd-55d4-45c3-aa47-224056eefe20",
      "name": "Search Month Folder",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        400,
        -528
      ]
    },
    {
      "id": "8f03819a-3323-4650-9b5e-5f62b1adc59a",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -368,
        -464
      ]
    },
    {
      "id": "d6cdabd3-5b9b-4c74-8240-3aa19b0710cc",
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2000,
        -528
      ]
    },
    {
      "id": "498d1043-b2cb-46b1-aee3-559e9c0c30b8",
      "name": "Email Trigger (IMAP)",
      "type": "n8n-nodes-base.emailReadImap",
      "position": [
        -848,
        -464
      ]
    },
    {
      "id": "e8f3c9a0-1234-5678-9abc-def012345678",
      "name": "Send to DateV",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        2688,
        -448
      ]
    },
    {
      "id": "b761dc97-01c1-4b3c-81b0-b2a9843e4766",
      "name": "MoveEmail email",
      "type": "n8n-nodes-imap.imap",
      "position": [
        3248,
        -288
      ]
    },
    {
      "id": "81514faf-73f4-45d9-b98a-edcb2b61971e",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        912,
        -800
      ],
      "parameters": {
        "width": 1392,
        "height": 480,
        "content": "## Extract & Log Invoice Data\n\nSteps:\n\t1. Extract From PDF – Reads the uploaded invoice PDF and extracts all visible text for analysis.\n\t2. Extract & Format Data (AI) – Uses an AI model to identify an"
      }
    },
    {
      "id": "699ea44c-8703-4d51-8fe3-e19f7620d8ec",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2448,
        -656
      ],
      "parameters": {
        "width": 432,
        "height": 384,
        "content": "## Send to DateV\n\nStep:\nSends the processed invoice as an email to your DateV inbox for accounting. The message includes the correctly named PDF as an attachment. Use your individual Datev-Inbox Mail "
      }
    },
    {
      "id": "31a23f05-18dc-4ba4-bd99-77bd3ac71506",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2976,
        -464
      ],
      "parameters": {
        "width": 464,
        "height": 336,
        "content": "## Move Email to Archive/Folder\n\nStep:\nMoves the processed email to a specific folder  after all actions are completed."
      }
    },
    {
      "id": "a11c1bc8-e810-4d38-98b6-adc0cf0f2dd8",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        96,
        -848
      ],
      "parameters": {
        "width": 560,
        "height": 528,
        "content": "## Upload to Temporary Storage\n\nSteps:\n\t1.\tDownload File – Retrieves the processed invoice PDF from the previous step or source node.\n\t2.\tUpload to Incoming Folder – Temporarily uploads the file to th"
      }
    },
    {
      "id": "cd47d134-ecca-451d-bf26-5b382ee499d0",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -944,
        -816
      ],
      "parameters": {
        "width": 480,
        "height": 512,
        "content": "## Receive IMAP-Mail & Extract Attachments from Email\n\nSteps:\n\t1.\tEmail Trigger (IMAP) – Detects new incoming emails in the inbox and retrieves all attachments.\n\t2.\tSplit Attachments (JavaScript) – Pr"
      }
    },
    {
      "id": "cf5ff710-5a7d-4f67-a427-dd4b707e8ab2",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1632,
        -1104
      ],
      "parameters": {
        "width": 464,
        "height": 800,
        "content": "## Workflow Overview — Automated Invoice Processing\n\nGoal:\nThis workflow automatically processes incoming invoice emails, extracts and structures all relevant data, stores the files in Google Drive, l"
      }
    },
    {
      "id": "18ef9aa2-b377-4f87-95cc-63fac8b26e26",
      "name": "Upload file",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        192,
        -528
      ]
    },
    {
      "id": "156bba85-1b84-4eab-8a8d-3916a343188e",
      "name": "Code in JavaScript",
      "type": "n8n-nodes-base.code",
      "position": [
        -640,
        -464
      ]
    },
    {
      "id": "21056d9c-e203-4402-ba04-f64ebdcddac9",
      "name": "Download file",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1040,
        -528
      ]
    },
    {
      "id": "d770bb51-a13c-4143-9c03-5d1481891907",
      "name": "Download file1",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        2512,
        -448
      ]
    },
    {
      "id": "e01165d1-2aef-4a47-971c-858d69ed93ca",
      "name": "Download file2",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        3024,
        -288
      ]
    },
    {
      "id": "b85d1bbe-03de-4f8d-8de6-5a1df1c897df",
      "name": "Download file3",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        3664,
        -176
      ]
    },
    {
      "id": "12bbabff-af3c-4eb7-b1fe-088896041e34",
      "name": "Upload file1",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        3856,
        -176
      ]
    },
    {
      "id": "7acea3fa-560e-4b07-aa83-e40385296055",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3568,
        -368
      ],
      "parameters": {
        "width": 464,
        "height": 352,
        "content": "## Upload to final destination\n\nSteps:\nDownloads the prepared file from the temporary storage and re-uploads it to the target folder defined by the month and year (based on the extracted invoice data)"
      }
    }
  ],
  "connections": {
    "Upload file": {
      "main": [
        [
          {
            "node": "Search Month Folder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload file1": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download file": {
      "main": [
        [
          {
            "node": "Extract From PDF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets": {
      "main": [
        [
          {
            "node": "Download file1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send to DateV": {
      "main": [
        [
          {
            "node": "Download file2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download file1": {
      "main": [
        [
          {
            "node": "Send to DateV",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download file2": {
      "main": [
        [
          {
            "node": "MoveEmail email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download file3": {
      "main": [
        [
          {
            "node": "Upload file1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Upload file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "MoveEmail email": {
      "main": [
        [
          {
            "node": "Download file3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract From PDF": {
      "main": [
        [
          {
            "node": "Extract & Format Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search Month Folder": {
      "main": [
        [
          {
            "node": "Download file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email Trigger (IMAP)": {
      "main": [
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract & Format Data": {
      "main": [
        [
          {
            "node": "Get Additional Date Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Additional Date Data": {
      "main": [
        [
          {
            "node": "Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}