Iteration Layer
Products
Use Cases
Resources
Pricing

Generate Formatted Excel Spreadsheets in n8n

9 min read

n8n Can Read Spreadsheets but Can’t Generate Them

n8n has solid spreadsheet reading support. The Spreadsheet File node parses XLSX and CSV. The Google Sheets node reads and writes rows. But generating a standalone XLSX file — with formatted headers, currency columns, multiple sheets, and formulas — does not have a native answer.

The workarounds are all painful. You can use a Function node with ExcelJS, but you are writing JavaScript to build a spreadsheet cell by cell. You lose the visual workflow benefit of n8n entirely. You can export from Google Sheets, but that means creating a temporary sheet, writing data, formatting it through the Google Sheets API (which has a separate formatting endpoint from the data endpoint), exporting to XLSX, and cleaning up the temporary file. That is five nodes for one spreadsheet.

Some teams use a Puppeteer node to render an HTML table and “print” it to XLSX. This works about as well as you would expect — the formatting is approximate, formulas are impossible, and multiple sheets are out of the question.

Define the Spreadsheet, Get an XLSX

Iteration Layer Sheet Generation takes a JSON definition and returns a binary XLSX file. You define sheets, columns, rows, cell formatting, and formulas. The API handles rendering. No code, no temporary files, no export chain.

The definition is declarative. You describe what the spreadsheet should look like — column widths, header styles, cell formats, formulas — and the API builds it. Currency formatting, percentage formatting, date formatting, bold headers, merged cells, and Excel formulas all work through the JSON definition.

The output is a standard XLSX file that opens in Excel, Google Sheets, LibreOffice, or any spreadsheet application. Or request CSV or Markdown format if you need a simpler output.

The Workflow: Supplier Invoices to SEPA Review Report

Here is what we are building in n8n: a weekly automated pipeline that queries reviewed supplier invoice data, generates a formatted Excel workbook with VAT and SEPA payment status, and emails it to the finance team. Four nodes. No Function nodes. No Google Sheets intermediary.

Step 1: Schedule Trigger

Open the n8n canvas and add a new node. Search for “Schedule Trigger” and add it.

In the node settings, set the Trigger Interval to “Weeks” and pick the day and time for your report — Monday at 8:00 AM is a common choice for finance review before a payment run. This fires the workflow automatically on schedule.

Step 2: Postgres Node (Query Approved Invoice Data)

Add a Postgres node (or MySQL, MSSQL, or any database node that fits your stack). Configure your database credentials and enter the query:

SELECT
  supplier_name,
  country_code,
  vat_id,
  iban,
  invoice_total_eur,
  vat_rate,
  approval_status
FROM supplier_invoices
WHERE received_at >= NOW() - INTERVAL '7 days'
ORDER BY invoice_total_eur DESC

The node returns an array of items, one per row. Each item has the column values as properties. This is the data that will populate the spreadsheet.

Step 3: Iteration Layer (Sheet Generation)

Add an Iteration Layer node. In the Resource dropdown, select Sheet Generation. Set the Format to xlsx.

In the Sheets JSON field, define the spreadsheet structure. Here is a concrete example with two sheets — an invoice detail sheet and a summary sheet:

{
  "sheets": [
    {
      "name": "Supplier Invoices",
      "columns": [
        {
          "name": "Supplier",
          "width": 30
        },
        {
          "name": "Country",
          "width": 15
        },
        {
          "name": "VAT ID",
          "width": 18
        },
        {
          "name": "IBAN",
          "width": 28
        },
        {
          "name": "Invoice Total",
          "width": 16
        },
        {
          "name": "VAT Rate",
          "width": 10
        },
        {
          "name": "Approval Status",
          "width": 18
        }
      ],
      "header_style": {
        "bold": true,
        "background_color": "#1a1a2e",
        "font_color": "#ffffff"
      },
      "rows": [
        {
          "values": [
            {
              "value": "Nordlicht Digital GmbH"
            },
            {
              "value": "DE"
            },
            {
              "value": "DE123456789"
            },
            {
              "value": "DE89370400440532013000"
            },
            {
              "value": 42458.00,
              "format": "currency",
              "currency": "EUR"
            },
            {
              "value": 0.19,
              "format": "percentage"
            },
            {
              "value": "Approved"
            }
          ]
        },
        {
          "values": [
            {
              "value": "Alpine Components GmbH"
            },
            {
              "value": "AT"
            },
            {
              "value": "ATU12345678"
            },
            {
              "value": "AT611904300234573201"
            },
            {
              "value": 13261.00,
              "format": "currency",
              "currency": "EUR"
            },
            {
              "value": 0.07,
              "format": "percentage"
            },
            {
              "value": "Review Required"
            }
          ]
        }
      ]
    },
    {
      "name": "Summary",
      "columns": [
        {
          "name": "Metric",
          "width": 25
        },
        {
          "name": "Value",
          "width": 20
        }
      ],
      "header_style": {
        "bold": true,
        "background_color": "#1a1a2e",
        "font_color": "#ffffff"
      },
      "rows": [
        {
          "values": [
            {
              "value": "Total Payable"
            },
            {
              "value": 55719.00,
              "format": "currency",
              "currency": "EUR"
            }
          ]
        },
        {
          "values": [
            {
              "value": "Approved Invoices"
            },
            {
              "value": 1
            }
          ]
        },
        {
          "values": [
            {
              "value": "Pending Review"
            },
            {
              "value": 1
            }
          ]
        },
        {
          "values": [
            {
              "value": "Approved Share"
            },
            {
              "value": "=1/2",
              "format": "formula"
            }
          ]
        }
      ]
    }
  ]
}

In practice, you would build the rows array dynamically using n8n expressions that reference the Postgres node output. The static example above shows the structure — column definitions with widths, header styling, and cell-level formatting for currency, percentages, and formulas.

Key formatting options:

The node returns the generated XLSX as n8n binary data, ready to attach to an email, upload to a file storage service, or pass to another node.

Step 4: Send Email Node

Add a Send Email node (or Gmail, Outlook, or any email node). Configure your SMTP credentials or OAuth connection.

Set the To field to the distribution list for the report. Add a subject line like Weekly SEPA Review Report — {{ $now.format('yyyy-MM-dd') }}. In the Attachments section, select the binary data output from the Iteration Layer node. The XLSX file attaches automatically.

The recipients get a formatted Excel file in their inbox every Monday morning. No Google Sheets link to lose access to. No CSV that loses all formatting on open. A proper XLSX with styled headers, currency formatting, and a summary sheet.

Beyond the Weekly Report

The same Sheet Generation resource handles many generated-spreadsheet workflows:

CSV and Markdown Alternatives

Not every use case needs a full XLSX. Set the Format to csv for a simple comma-separated output, or markdown for a Markdown table. The same sheet definition works for all three formats — change one parameter and the output format changes.

CSV is useful when the downstream system only accepts plain text. Markdown is useful when the spreadsheet data feeds into documentation, a chat message, or a Markdown-based CMS.

Get Started

Use the official verified Iteration Layer n8n listing or the n8n-nodes-iterationlayer community package to add Iteration Layer to n8n. The Sheet Generation docs cover all formatting options, formula syntax, and multi-sheet configuration. The n8n integration docs walk through every resource and parameter.

Start with a simple single-sheet report. Define your columns, add a few rows with formatting, and check the output in Excel or Google Sheets. Once the structure looks right, wire it up to your data source and schedule trigger. Sign up to get your API key.

Related reading

Learn how to turn the same pattern into production-ready document, image, and automation workflows.

Try with your own data

Get a free API key and run this in minutes.