Skip to content

CSV Downloader

The ui-csv-downloader node is a hidden widget that provides automatic CSV file downloads from data objects. It listens to incoming messages, converts the specified object to CSV format and triggers its download in the user's browser, with no interaction required and without showing any visible element on the dashboard.

The conversion takes the object keys as the CSV headers and their values as the data row (applying JSON.stringify to handle nested objects and arrays correctly). The file name is generated automatically from the object's sessionId if available; otherwise a timestamp is used.

Features

  • Automatic CSV conversion: converts any JavaScript object to CSV format automatically.
  • Configurable field extraction: supports simple fields and nested fields through dot notation.
  • Automatic download: creates and downloads the CSV file without user intervention.
  • Smart file name: uses sessionId if available; otherwise it falls back to a timestamp.
  • Hidden component: it has no visible interface and works in the background.
  • JSON serialisation: correctly handles nested objects and arrays inside the CSV.

Configuration

PropertyDescriptionDefault
nameNode name shown in the editor.""
pageDashboard page the widget is registered on.
fieldMessage field (after msg.) that is converted to CSV. Supports simple fields (payload, data, row) and nested fields with dot notation (payload.csvData, data.table)."payload"

Input

The node has 1 input. The object to convert is taken from the message field given in the field setting. The object keys become the CSV headers and their values the data row. If the object includes a sessionId property, it is used to name the downloaded file.

With the default field (payload):

js
msg.payload = {
    name: "John",
    age: 30,
    city: "New York"
};

With a custom field, setting Field = "data":

js
msg.data = {
    product: "Widget",
    price: 29.99,
    quantity: 10
};

With a nested field, setting Field = "payload.csvData":

js
msg.payload = {
    csvData: {
        sessionId: "abc123",
        value: 42
    }
};

Output

The node has 1 output and, by default, forwards the received message (passthru enabled). The CSV conversion and download happen entirely in the browser; the output only serves to chain the message with downstream nodes in the flow.

Usage example

A common use is exporting the data of a row from a dashboard table. You connect the output of a UI Table to a Switch node that filters button click events, and from there to the CSV Downloader:

UI Table → Switch (msg.action === "button_click") → CSV Downloader

With the setting Field = "payload", when the row is received:

js
msg.payload = {
    sessionId: "session_123",
    timestamp: "2024-01-01T10:00:00",
    temperature: 25.5,
    humidity: 60
};

The file session_session_123.csv is downloaded automatically. If the object does not contain sessionId, the file is named with a timestamp (for example, session_{timestamp}.csv).