{
  "name": "Export zu Import ohne API (Vorlage clxdigital.de)",
  "nodes": [
    {
      "parameters": {},
      "id": "40e2a5d1-73e6-5bc6-bbfc-6a655270c6b1",
      "name": "Testlauf starten",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        -100
      ]
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "minutes",
              "minutesInterval": 15
            }
          ]
        }
      },
      "id": "9073f32d-d878-5f87-8e99-6c388329e895",
      "name": "Alle 15 Minuten",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        0,
        100
      ]
    },
    {
      "parameters": {
        "fileSelector": "/home/node/.n8n-files/export/*.csv",
        "options": {}
      },
      "id": "39bca90f-8d79-5eb0-b1f7-e1cfe8343965",
      "name": "Export-Dateien lesen",
      "type": "n8n-nodes-base.readWriteFile",
      "typeVersion": 1.1,
      "position": [
        240,
        0
      ]
    },
    {
      "parameters": {
        "options": {
          "delimiter": ";",
          "headerRow": true
        }
      },
      "id": "6f87ff33-e375-5e09-bb23-c488f41dfa6c",
      "name": "CSV auslesen",
      "type": "n8n-nodes-base.extractFromFile",
      "typeVersion": 1.1,
      "position": [
        480,
        0
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": false,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "c1",
              "leftValue": "={{ $json['Status'] }}",
              "rightValue": "abgeschlossen",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "looseTypeValidation": true,
        "options": {}
      },
      "id": "19ef0afd-530f-5990-a883-74005c159091",
      "name": "Nur abgeschlossene",
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2.2,
      "position": [
        720,
        0
      ]
    },
    {
      "parameters": {
        "operation": "removeItemsSeenInPreviousExecutions",
        "dedupeValue": "={{ $json['Auftragsnr'] }}",
        "options": {}
      },
      "id": "854d31ea-4f40-5502-b22b-28cc5c4b11c7",
      "name": "Schon übertragen?",
      "type": "n8n-nodes-base.removeDuplicates",
      "typeVersion": 2,
      "position": [
        960,
        0
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "m1",
              "name": "belegnummer",
              "value": "={{ $json['Auftragsnr'] }}",
              "type": "string"
            },
            {
              "id": "m2",
              "name": "kunde",
              "value": "={{ $json['Kunde'].trim() }}",
              "type": "string"
            },
            {
              "id": "m3",
              "name": "datum",
              "value": "={{ DateTime.fromFormat($json['Datum'], 'dd.MM.yyyy').toFormat('yyyy-MM-dd') }}",
              "type": "string"
            },
            {
              "id": "m4",
              "name": "betrag_netto",
              "value": "={{ parseFloat(String($json['Betrag netto']).replace(/\\./g, '').replace(',', '.')).toFixed(2) }}",
              "type": "string"
            },
            {
              "id": "m5",
              "name": "kostenstelle",
              "value": "={{ $json['Kostenstelle'] || '100' }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "f3dcd2a1-d67e-56a2-a208-becd294392e1",
      "name": "Felder zuordnen",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1200,
        0
      ]
    },
    {
      "parameters": {
        "options": {
          "delimiter": ";",
          "headerRow": true
        }
      },
      "id": "6e339072-d313-5cd9-9799-b44b78c62afb",
      "name": "Als CSV aufbereiten",
      "type": "n8n-nodes-base.convertToFile",
      "typeVersion": 1.1,
      "position": [
        1440,
        0
      ]
    },
    {
      "parameters": {
        "operation": "write",
        "fileName": "=/home/node/.n8n-files/import/import-{{ $now.toFormat('yyyy-LL-dd-HHmmss') }}.csv",
        "options": {}
      },
      "id": "8ea4bf50-573c-5ff9-b69a-8494e4c6c834",
      "name": "In Import-Ordner speichern",
      "type": "n8n-nodes-base.readWriteFile",
      "typeVersion": 1.1,
      "position": [
        1680,
        0
      ]
    },
    {
      "parameters": {
        "content": "## Export zu Import ohne API\nVorlage von clxdigital.de/anleitungen\n\n- Programm A legt CSV-Exporte in **export/** ab.\n- n8n liest sie, filtert, ordnet die Felder nach deiner Mapping-Tabelle zu und schreibt eine Importdatei nach **import/**.\n- Programm B liest **import/** ein.\n\nPfade gelten für n8n selbst gehostet (Docker). Nur Testdaten.",
        "height": 250,
        "width": 520,
        "color": 7
      },
      "id": "ca552560-df17-5c8d-9929-bf132fb30e40",
      "name": "Hinweis",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -60,
        -400
      ]
    }
  ],
  "connections": {
    "Testlauf starten": {
      "main": [
        [
          {
            "node": "Export-Dateien lesen",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Alle 15 Minuten": {
      "main": [
        [
          {
            "node": "Export-Dateien lesen",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Export-Dateien lesen": {
      "main": [
        [
          {
            "node": "CSV auslesen",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "CSV auslesen": {
      "main": [
        [
          {
            "node": "Nur abgeschlossene",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Nur abgeschlossene": {
      "main": [
        [
          {
            "node": "Schon übertragen?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schon übertragen?": {
      "main": [
        [
          {
            "node": "Felder zuordnen",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Felder zuordnen": {
      "main": [
        [
          {
            "node": "Als CSV aufbereiten",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Als CSV aufbereiten": {
      "main": [
        [
          {
            "node": "In Import-Ordner speichern",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": false
  }
}