Read a File as Data
Read a File as Data turns a CSV, spreadsheet or XML file, or a SQLite
database, into JSON the rest of the flow can address with expressions. It is the data counterpart to
Read a File as Text, which extracts a document’s text:
this one answers “what is in column C”, not “what does this say”. You find it on
the node picker’s Transform & data shelf.
The node has one input handle and one output handle.
What it reads
Section titled “What it reads”The format is detected from the file’s own bytes first. The type a sender
declared counts only when it says something, and the file’s name is used when
neither does. Mail clients send application/octet-stream routinely, so
trusting the declaration would fail on ordinary attachments.
A file that is only known to be plain text is read by what it contains: one that
starts with < is read as XML, and one whose lines split into consistent
columns is read as a CSV. That is how a semicolon export from Dutch Excel, or
CSV text pasted into source, is read. Anything else is refused as plain text
that does not look like a table. A CSV that Windows labels as an Excel file
(application/vnd.ms-excel), which Outlook does for every .csv, is read as the
CSV it is.
| Format | Notes |
|---|---|
| CSV and TSV | The delimiter is detected by trying the candidates and keeping the one that produces a consistent column count. A semicolon-delimited European export is read correctly, and so is a comma inside a quoted sentence. Latin-1 and other encodings are converted. |
Excel (.xlsx, .xlsm, .xls) and OpenDocument (.ods) |
Read a sheet at a time. A formula cell yields its result, never the formula text: the result the file stored when it was last saved, or, for a workbook a program generated without results, the result worked out while reading. A result that cannot be worked out is left empty rather than read as 0, and meta says which cells, and why, in formula_note, beside the counts formulas_stored, formulas_calculated and formulas_uncalculated. |
| XML | Read as a tree, or as a stream of records when you name the repeating element. |
SQLite (.sqlite, .db, and files such as IBIS’s .xtb that are SQLite inside) |
One table, one query, or a list of the database’s tables. Known by its bytes, whatever its name ends in. |
Configuration
Section titled “Configuration”

| Field | Type | Default | Description |
|---|---|---|---|
File (source) | string ✦ (required) | — | The file to read: a stored file, an inbound email attachment, or raw text. |
Sheet (sheet) | string ✦ (optional) | — | Which sheet of a workbook, or which table of a SQLite database, by name or by position. Leave empty to read every sheet, keyed by sheet name. |
Query (query) | string ✦ (optional) | — | For a SQLite database: one SELECT to run against it, e.g. a recursive query over a budget’s lines. Leave empty to read a whole table instead. |
Header row (headerRow) | integer ✦ (optional) | — | Which row holds the column names, counting from 1. Set 0 for a file with no header row. |
Record element (recordElement) | string ✦ (optional) | — | For XML: the element that holds one record, e.g. BEGROTINGSREGEL. Leave empty to read the whole document as a tree. |
Row limit (maxRows) | integer ✦ (optional) | — | The most rows to read. Defaults to 5000. |
Stop on a bad row (failOnBadRow) | boolean ✦ (optional) | — | Fail when a row cannot be parsed, rather than returning the rest. |
Read cell details (cellDetails) | boolean ✦ (optional) | — | For a spreadsheet: also return each cell’s colours, font, formula, displayed text, comment and link, and which rows and columns are hidden. |
Fields marked ✦ accept expressions.
Try this node — run it once against your own workspace, with your credentials, without building a flow first.
source accepts a stored file, an inbound email attachment, or raw text. See
File Details for the ways a file can be named. A
value shaped like a reference (an id, or Store/path) that finds no file fails
with No file found rather than being read as text. Paths are case-sensitive.
In the node’s settings, File picks a stored file. Type part of its path, and
the field lists the matching files of every file store in your workspace as
Store › path, the newest first, 50 at most. A picked file is saved as its
object id. For an email attachment, raw text or a file another node produced,
click Insert a value ({x}) and write it there. A source typed in before the
field became a picker stays as it was.
Name the repeating element for XML
Section titled “Name the repeating element for XML”An XML element that appears once is an object and twice is a list, so a document with one record and a document with two produce differently shaped JSON, and an expression written against one breaks on the other.
Setting recordElement to the element that holds a record makes data a list
of that element every time, whatever the document happened to contain. In
practice this is not optional for any XML you receive repeatedly.
Leave it empty and the whole document is read as a tree, which is what you want for a configuration file or a single-record document.
Query a SQLite database
Section titled “Query a SQLite database”A SQLite database is read in one of three ways:
| Set | You get |
|---|---|
| Neither Sheet nor Query | The database’s tables and views, each with its columns and, for a table, its row count. meta.shape is schema. Start here to see what a file holds. |
Sheet (sheet) |
Every row of that table or view, by name in any case, or of the table at that position, counting from 1. |
Query (query) |
The rows of one SELECT you write, including a recursive one (WITH RECURSIVE) that walks a tree of budget lines. |
Set one of the two, not both. Values keep their type: whole numbers, decimals,
text and empty values come back as such. A value that is not text, such as an
image stored in the database, comes back as base64, and meta.binary_columns
names its columns.
The query runs on a private copy of the file that cannot be changed, and only a
single statement that reads is accepted: PRAGMA, ATTACH, changes and
extensions are refused, and so is anything after the first ;. A damaged file is
refused before any query runs.
WITH RECURSIVE tree(id, code, description, amount, depth) AS ( SELECT id, code, description, amount, 0 FROM lines WHERE parent IS NULL UNION ALL SELECT l.id, l.code, l.description, l.amount, tree.depth + 1 FROM lines l JOIN tree ON l.parent = tree.id)SELECT code, description, amount, depth FROM tree ORDER BY codeOutput
Section titled “Output”Every format produces the same envelope:
{ "data": [ { "sku": "A-100", "qty": 4, "price": "12.50" } ], "meta": { "format": "csv", "shape": "table", "delimiter": ";", "encoding": "ISO-8859-1", "rows": 1, "columns": 3, "rows_truncated": false, "media_type": "text/csv", "parser": "CsvStructuredDriver" }, "rejects": []}meta varies with the format: a workbook reports sheets, XML reports its
root element and any namespace mapping, and a SQLite read reports its source
(the table, or query). shape is table for a list of rows, tree for a whole
XML document and schema for a SQLite database’s list of tables, and is the field
to branch on when a flow handles more than one.
Every record of a sheet has the same keys. A sheet’s columns reach as far as its
widest filled row, so a note typed beside the table is kept, under Column 12
for the twelfth column, and the records without one have that key empty.
Read what the cells look like
Section titled “Read what the cells look like”A kept spreadsheet often says as much in its layout as in its values: a yellow
cell still waits for a price, a struck-through line was cancelled, a hidden row
no longer counts. Turn on Read cell details (cellDetails) and each record
says what its cells look like and where it sits in the sheet. The values stay
exactly where they are, so an expression on them reads the same either way.
{ "Omschrijving": "Glas 35 dB waarde", "hoev": 79.491, "subtotaal": 20349.696, "_row": 16, "_cells": { "Omschrijving": { "fill": "#FFC000" }, "hoev": { "fill": "#FFC000", "formula": "=B34-B11", "text": "79.49" }, "subtotaal": { "fill": "#FFC000", "formula": "=B16*J16", "text": "€ 20,349.70", "note": "m2 uit model", "note_author": "Jurjen" } }}| Key | Holds |
|---|---|
_row |
The record’s row in the sheet, the number Excel shows beside it. |
_hidden |
true when the row is hidden. Left out when it is not. |
_cells |
For each column, what its cell looks like. A column with a plain cell is left out, and so is _cells for a row of plain cells. |
A cell in _cells has only the keys where it differs from a plain cell:
| Key | Holds |
|---|---|
fill |
The background colour, as #RRGGBB. Kept on an empty cell too: a coloured blank is often the point. |
color |
The text colour, when it is not black. |
bold, italic, underline, strike |
true when the text is. |
formula |
The formula, beside its result in the value. |
text |
A number or date as the sheet shows it: with its currency, its decimals, its date order, and the separators of the workspace’s number format. |
note, note_author |
The cell’s comment, and who wrote it. |
link |
The cell’s link. One to a place in the workbook starts with #, as in #Sheet2!A1. |
A cell merged into the one before it has nothing of its own to say, so only the
first cell of a merged range appears. A column whose header is itself _row,
_hidden or _cells is renamed _row (2) and so on, while the option is on.
meta.layout describes each sheet, by its name:
"layout": { "4400 glasw": { "header_row": 7, "columns": { "A": "Omschrijving", "B": "hoev", "L": "Column 12" }, "hidden_columns": ["prijs/ehd (2)", "subtotaal (2)"], "hidden_rows": [21, 22, 23], "merged": ["J1:K1", "D73:E73"] }}columns maps each column letter to the key it has in the records, so a flow can
tell a person “column L of row 16”. A sheet that is itself hidden also has
"hidden": true. With Header row set to 0, header_row is null and every
column is named by its position.
A workbook read with its details is read whole. One with more than 200,000 cells (an empty cell with formatting counts) fails the node with a message that names the option. Turn it off to read the values. The option does nothing for CSV, XML or SQLite.
Rows that will not parse
Section titled “Rows that will not parse”This applies to CSV. Stop on a bad row (failOnBadRow) is on by default: a
row with more cells than the header fails the node, naming the row and the reason.
An extra cell is usually a delimiter inside an unquoted field, and accepted quietly
it would shift every column after it by one, so the error would surface as wrong
data rather than as a failure.
Turn it off and the run continues with whatever parsed, and each bad row lands
in rejects with its line number:
{ "row": 42, "reason": "8 fields, but the header declares 7." }A row with fewer cells than the header is read, with the missing cells empty, because exports routinely leave off a trailing empty field.
A spreadsheet has no rows like that. Every cell sits in its own column, so a value past the header’s last column shifts nothing: it is kept, as described under Output.
Limitations
Section titled “Limitations”- Row limit (
maxRows) defaults to 5000 and is a real ceiling, not a suggestion. A file with more rows fails the node, naming the limit, rather than returning the first 5000 as if they were the whole file. A file of exactly 5000 rows reads. The output is JSON in a run log, and a fan-out over it is written to the log again. To load a large file into storage, use Load a File into a Table, which never emits the rows. - A SQLite read is stopped after 20 seconds, and its rows may come to no more
than 32 MB. A query that joins or recurses without a limit can run forever, so
give it one. A
-walfile beside the database is not read: changes the program had not yet saved into the database file itself are missing, so read a file the program has closed. - Read cell details reads the formatting a cell was given. A colour that conditional formatting paints on when a rule matches is not read.
- PDF and Word documents are not data. Use Read a File as Text to extract their text.
- The whole file is read into memory before it is parsed, so its size is bounded by the file store’s size limit and the worker’s memory. Naming the XML record element keeps the parsed result small, not the file.
Related
Section titled “Related”- Load a File into a Table: the same read, straight into a table, at bulk sizes.
- Create a File: the other direction.
- Read a File as Text: a document’s text rather than its data.
- Parallel: process each row in its own branch.
- Files: creating a store, retention, versions and sharing.