{
  "name": "Rechnungs-PDFs aus dem Postfach in Google Drive ablegen",
  "nodes": [
    {
      "parameters": {
        "content": "## Rechnungs-PDFs aus dem Postfach in Google Drive ablegen\n\n**Zweck:** Liest ungelesene Mails aus einem Rechnungspostfach, nimmt nur Mails mit PDF-Anhang und legt das erste PDF mit Datum im Dateinamen in einem Drive-Ordner ab.\n\n**Zugangsdaten (Credentials):**\n- IMAP: Zugang zum Rechnungspostfach (am besten ein eigenes Postfach)\n- Google Drive: Google OAuth2\n\n**Anpassen:**\n- Postfach-Ordner in „Postfach lesen“ (Standard INBOX)\n- Zielordner in „In Drive ablegen“ (Standard: Hauptordner)\n- Für Nextcloud den Drive-Node durch den Nextcloud-Node (Upload) ersetzen\n\nValidiert am 09.11.2026 gegen das n8n-Node-Schema, nicht in Produktion ausgeführt.\nQuelle: automationskompass.de/n8n-templates/",
        "height": 520,
        "width": 420,
        "color": 7
      },
      "id": "24754eb7-b6e4-4702-b600-c000f9ae2476",
      "name": "Notiz",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -520,
        120
      ]
    },
    {
      "parameters": {
        "mailbox": "INBOX",
        "postProcessAction": "read",
        "downloadAttachments": true,
        "options": {
          "customEmailConfig": "[\"UNSEEN\"]"
        }
      },
      "id": "7e6db9c7-01cf-40b2-9576-f226c159ef41",
      "name": "Postfach lesen",
      "type": "n8n-nodes-base.emailReadImap",
      "typeVersion": 2.1,
      "position": [
        0,
        300
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "c7e2ee30-c96a-4722-ace4-c6bdf884a003",
              "leftValue": "={{ $binary.attachment_0 ? $binary.attachment_0.mimeType : \"\" }}",
              "rightValue": "application/pdf",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "7471a60f-058c-4514-af5f-aed001000ef1",
      "name": "Hat PDF-Anhang?",
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2.3,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "resource": "file",
        "operation": "upload",
        "name": "={{ $now.toFormat('yyyy-MM-dd') }}_{{ $binary.attachment_0.fileName }}",
        "driveId": {
          "__rl": true,
          "value": "My Drive",
          "mode": "list",
          "cachedResultName": "My Drive"
        },
        "folderId": {
          "__rl": true,
          "value": "root",
          "mode": "list",
          "cachedResultName": "/ (Root folder)"
        },
        "inputDataFieldName": "attachment_0",
        "options": {}
      },
      "id": "52a0b4df-8682-4328-8ae7-3a076f452960",
      "name": "In Drive ablegen",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        480,
        300
      ]
    }
  ],
  "connections": {
    "Postfach lesen": {
      "main": [
        [
          {
            "node": "Hat PDF-Anhang?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Hat PDF-Anhang?": {
      "main": [
        [
          {
            "node": "In Drive ablegen",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1",
    "timezone": "Europe/Berlin"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  }
}
