Skip to main content

Convert to File

Turns any value into a file with a name and content type, ready to store with the File step or send as an HTTP request body or form field. To make an Excel workbook (.xlsx) from items, use Spreadsheet File.

Properties​

PropertyRequiredDescription
DataYesThe content. Supports expressions
File nameYesFile name including extension, e.g. report.json. Supports expressions
Content typeYesMIME type, e.g. application/json, text/csv. If left empty, application/octet-stream is used

Behaviour​

DataFile content
TextThe text as written
A list (or one object) with a CSV content type (text/csv) or a .csv file nameCSV: a header line with the column names, one line per item (see below)
A list with text/tab-separated-values or a .tsv file nameThe same, separated by tabs
A list with application/x-ndjson or a .jsonl / .ndjson file nameJSON Lines: one item per line
Any other object or arrayThe value serialised as JSON
A file alreadyThe same bytes; only the name and content type change

CSV​

  • The columns are every key that appears in the items, in the order they first appear. An item without a key leaves that cell empty.
  • Values containing a comma, a quote, a line break, or spaces at the start or end are wrapped in quotes, with quotes doubled (the usual CSV rules, so Excel, Google Sheets and Parse CSV read them back exactly).
  • Nested objects and lists are written as JSON text. Lines end with CRLF.
  • If the items are lists themselves, each list is written as a row as it is, without a header.

Encoding​

Files are UTF-8 without a byte order mark. Add a charset to the content type to change that:

Content typeEncoding
text/csvUTF-8
text/csv; charset=utf-8-sigUTF-8 with a byte order mark, so Excel shows accented letters correctly
text/csv; charset=utf-16UTF-16
text/csv; charset=iso-8859-1Latin-1

Large files​

Files up to 1 MB are part of the step's output. Larger ones are written to temporary storage and the output is a file reference instead, which every step that takes a file accepts. Use File → Store to keep it.

Output​

A file. Use it wherever a step expects a file:

  • File → Store, to keep it in a storage provider.
  • HTTP Request → Body: Binary, or a Form Data field in file mode, to upload it to an API.

Example​

Save an API response as a dated JSON file:

  1. HTTP Request fetches the data.
  2. Convert to File:
    • Data: {{ $nodes['HTTP Request'].responseBody }}
    • File name: export-{{ $today.toFormat('yyyy-MM-dd') }}.json
    • Content type: application/json
  3. File with operation Store, File set to {{ $nodes['Convert to File'] }}.

Notes​

  • To build CSV, pass the list of items and use the content type text/csv (or a .csv file name). Text you pass is written as it is.
  • Renaming a stored file this way doesn't copy it — the new name and type apply to the reference passed downstream.