{
  "name": "Extract Invoices and Build Accounts Payable Spreadsheet",
  "nodes": [
    {
      "parameters": {
        "content": "## Extract Invoices and Build Accounts Payable Spreadsheet\n\nAccounts payable teams receive PDF invoices from multiple vendors and need to log them into a spreadsheet for the approval workflow. This recipe extracts structured data from all invoices in a single call, then feeds the results directly into an XLSX tracker with one row per invoice.\n\n**Note:** This workflow uses the Iteration Layer community node (`n8n-nodes-iterationlayer`). Install it via Settings > Community Nodes on self-hosted n8n, or add it directly on n8n Cloud with Verified Community Nodes enabled.",
        "height": 280,
        "width": 500,
        "color": 2
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        200,
        40
      ],
      "id": "b74d5200-3556-44d1-9654-3cf1b1cb17a8",
      "name": "Overview"
    },
    {
      "parameters": {
        "content": "### Step 1: Extract Invoice Data\nResource: **Document Extraction**\n\nConfigure the Document Extraction parameters below, then connect your credentials.",
        "height": 160,
        "width": 300,
        "color": 6
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        475,
        100
      ],
      "id": "d2e01ad3-378d-4e57-b265-a818cc18ae11",
      "name": "Step 1 Note"
    },
    {
      "parameters": {
        "content": "### Step 2: Generate AP Spreadsheet\nResource: **Sheet Generation**\n\nConfigure the Sheet Generation parameters below, then connect your credentials.",
        "height": 160,
        "width": 300,
        "color": 6
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        725,
        100
      ],
      "id": "cb8ecc73-6801-47f2-b17a-948e94a8dd19",
      "name": "Step 2 Note"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        250,
        300
      ],
      "id": "7a8b9c0d-1e2f-3456-0123-678901234567",
      "name": "Manual Trigger"
    },
    {
      "parameters": {
        "resource": "documentExtraction",
        "schemaInputMode": "rawJson",
        "schemaJson": "[\n  {\n    \"name\": \"invoices\",\n    \"type\": \"ARRAY\",\n    \"description\": \"One entry per invoice file\",\n    \"children\": [\n      {\n        \"name\": \"vendor_name\",\n        \"type\": \"TEXT\",\n        \"description\": \"Vendor or supplier name\"\n      },\n      {\n        \"name\": \"invoice_number\",\n        \"type\": \"TEXT\",\n        \"description\": \"Invoice reference number\"\n      },\n      {\n        \"name\": \"invoice_date\",\n        \"type\": \"DATE\",\n        \"description\": \"Invoice issue date\"\n      },\n      {\n        \"name\": \"due_date\",\n        \"type\": \"DATE\",\n        \"description\": \"Payment due date\"\n      },\n      {\n        \"name\": \"total_amount\",\n        \"type\": \"CURRENCY_AMOUNT\",\n        \"description\": \"Total invoice amount\"\n      },\n      {\n        \"name\": \"currency\",\n        \"type\": \"CURRENCY_CODE\",\n        \"description\": \"Invoice currency\"\n      }\n    ]\n  }\n]",
        "files": {
          "fileValues": [
            {
              "inputMode": "url",
              "fileUrl": "https://example.com/invoices/invoice-acme.pdf"
            },
            {
              "inputMode": "url",
              "fileUrl": "https://example.com/invoices/invoice-brightway.pdf"
            },
            {
              "inputMode": "url",
              "fileUrl": "https://example.com/invoices/invoice-delta-freight.pdf"
            }
          ]
        }
      },
      "type": "n8n-nodes-iterationlayer.iterationLayer",
      "typeVersion": 1,
      "position": [
        500,
        300
      ],
      "id": "8b9c0d1e-2f3a-4567-1234-789012345678",
      "name": "Extract Invoice Data",
      "credentials": {
        "iterationLayerApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "sheetGeneration",
        "sheetFormat": "xlsx",
        "sheetsJson": "[\n  {\n    \"name\": \"Accounts Payable\",\n    \"columns\": [\n      { \"name\": \"Vendor\", \"width\": 30 },\n      { \"name\": \"Invoice #\", \"width\": 18 },\n      { \"name\": \"Invoice Date\", \"width\": 14 },\n      { \"name\": \"Due Date\", \"width\": 14 },\n      { \"name\": \"Amount\", \"width\": 16 },\n      { \"name\": \"Currency\", \"width\": 12 },\n      { \"name\": \"Status\", \"width\": 14 }\n    ],\n    \"rows\": \"{{ $json.invoices }}\"\n  }\n]",
        "sheetStylesJson": "{\n  \"header\": {\n    \"is_bold\": true,\n    \"background_color\": \"#1E3A5F\",\n    \"font_color\": \"#FFFFFF\"\n  },\n  \"body\": {\n    \"font_color\": \"#333333\"\n  }\n}"
      },
      "type": "n8n-nodes-iterationlayer.iterationLayer",
      "typeVersion": 1,
      "position": [
        750,
        300
      ],
      "id": "9c0d1e2f-3a4b-5678-2345-890123456789",
      "name": "Generate AP Spreadsheet",
      "credentials": {
        "iterationLayerApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Manual Trigger": {
      "main": [
        [
          {
            "node": "Extract Invoice Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Invoice Data": {
      "main": [
        [
          {
            "node": "Generate AP Spreadsheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}