Skip to main content

To CSV

Writes an array out as CSV text, quoting any cell that needs it.

To CSV turns an array into CSV text. Records become rows: leave Columns empty and every property found on the records is written, in the order they were first seen, or name the columns yourself to fix the order and drop the rest. An array of arrays — what Parse CSV produces with Has Header unticked — is written cell for cell with no header invented. The correctness of a CSV writer is entirely about quoting, and this one gets it right: any cell containing the delimiter, a quote or a newline is wrapped in quotes with its own quotes doubled, so the output reads back through Parse CSV unchanged. The record id the runtime mints is not written unless you name it in Columns, because it is not a column you put there.

When to use it

Answering with a spreadsheet: a cloud function replying to an export request, a download button in a browser app, a file written to storage. Pair it with Parse CSV for 'read a supplier's file, filter it, send it back'.

At a glance

CategoryData
Type namenet.noodl.ToCSV
Available inbrowser, cloud
SSR compatibilitysafe
Provided bynoodl-runtime

Inputs

Values

NameTypeDefaultDescription
columnsStringlistWhich properties to write, in order, comma separated. Leave it empty and every property found on the records is written, in the order they were first seen
delimiterString,The character between cells. Any cell containing it is quoted automatically
includeHeaderBooleantrueWrite the column names as the first row
itemsArrayThe array to write. Records become rows; an array of arrays is written cell for cell

Outputs

Values

NameTypeDefaultDescription
countNumberHow many data rows were written, not counting the header row
textStringThe array as CSV text. Cells containing the delimiter, a quote or a newline are quoted and their quotes doubled, so this round-trips back through Parse CSV unchanged

Signals

NameTypeDefaultDescription
changedSignalFires once CSV holds the freshly written text

Patterns

  • Query Records items → To CSV items; To CSV text → Response pm-csv: an export endpoint in three nodes.
  • Parse CSV → Array Filter → To CSV: read, narrow, write back. The round trip is exact, including cells containing commas, quotes and newlines.

Watch out for

  • Building CSV by joining strings in an Expression or Function node. That is the quoting rule reimplemented, and it is wrong the first time a cell contains a comma.
  • Passing an array of arrays and expecting a header row. There are no column names to write; use records if you want one.

Parse CSV, Static Array, Array Filter, Array Map

Generated

This page is generated from node-catalog-enriched.json. Do not edit it by hand — run npm run docs:nodes to regenerate, and fix the source enrichment instead.