Output · Files

Write CSV

Saves the table as a CSV file. It can create a new file, replace one (keeping a backup) or append to it; the delimiter, header and quoting are up to you.

Also known as: Export, save as

How it works

Type the CSV file name (output.csv by default) and pick a Location; blank means the project folder. Write mode is Create by default, which stops if the file already exists; Replace overwrites it, and with Keep a backup of the file it replaces ticked (the default) the old file is renamed to .bak first; Append adds rows under the header already in the file, matched by column name. Write formatted values writes numbers and dates as they print upstream, such as $1,234.50, which turns those columns into text.

Under Format, Delimiter offers a comma (the default), semicolon, Tab or pipe; Header row writes the column names, and should stay on when you append; Quotes is Minimal by default, or All, Non-numeric or None, which writes no quotes at all and is only safe when no value can contain the delimiter. Quote character is double by default; choosing single switches Escape style to Backslash. The written file is passed on downstream as a File.

Inputs and outputs

Inputs

  • data — Table

Outputs

  • file — File

Settings

The Attributes panel of Write CSV, as in the app: the controls work, but nothing runs — there is no data behind it.

The same settings, as the Assistant writes them
{
  fileName: string
  directory?: string
  mode: "create"|"replace"|"append"
  backup?: boolean
  formatValues?: boolean
  delimiter?: string
  header?: boolean
  quoting?: "minimal"|"all"|"nonnumeric"|"none"
  quoteChar?: "\""|"'"
  escapeStyle?: "doubled"|"backslash"
}

"create" stops if the file exists, "replace" overwrites it, "append" adds rows under the header already there (matched by column name). backup (default true) makes "replace" rename the old file to "<name>.bak" first. formatValues writes the values as they print upstream ("$1,234.50") instead of raw numbers — handy for a hand-off, but the formatted columns become text. delimiter is one character (";" for the European-Excel convention, "\t" for TSV), default ",". header writes the column-name row, default true — turn it off only for a consumer that wants bare rows, never with mode "append", which matches columns by name against that header. quoting defaults to "minimal" (quote only what needs it); "none" writes no quotes at all, so pick it only when no value can contain the delimiter — the file is otherwise unreadable. quoteChar defaults to a double quote; choosing a single quote forces escapeStyle "backslash", because the doubled combination writes a file no reader can be configured for.

Example

A daily job adds today's rows to one running file. Set the CSV file to sales-log.csv, Write mode to Append and leave Header row on. For a colleague's European Excel, choose the semicolon Delimiter instead.