<!-- BusyBot node reference — https://busybot.net/tools/convert-to-file/ -->

> Node: Convert to File (`convert_to_file`) · Action (binary) · v1
> Category: Core Nodes · Credentials: none
> Updated: 2026-08-16

# Convert to File

> Convert JSON data into binary files (CSV, XLSX, JSON, text, ICS, and more)

## Overview

The Convert to File tool transforms structured JSON data or text strings into binary file formats. For spreadsheet formats (CSV, HTML, RTF, ODS, XLS, XLSX), it aggregates ALL input items into a single output file (many-to-one pattern). For JSON output, it supports two modes: all items into one file (once) or each item as a separate file (each). For text and base64-to-binary operations, each input item produces its own output file (one-to-one). For ICS calendar events, each input item generates a separate .ics file. No external API calls or credentials required.

**Category:** Core Nodes  
**Tool Name:** `convert_to_file`  
**Version:** 1

**Appearance:** Icon: `lucide-FileInput` | Color: `#2244FF`

## Node Type

**Action (Binary)** — handles file/binary data operations

## Input / Output

| Direction | Port(s) |
|-----------|--------|
| Input | `Input` |
| Output | `Output`, `Error` |

## Credentials

This tool does not require any credentials.

### Operations

| Operation | Value | Description |
|-----------|-------|-------------|
| Convert to CSV | `csv` | Transform input data into a CSV file |
| Convert to HTML | `html` | Transform input data into a table in an HTML file |
| Convert to ICS | `iCal` | Converts each input item to an ICS event file |
| Convert to JSON | `toJson` | Transform input data into a single or multiple JSON files |
| Convert to ODS | `ods` | Transform input data into an ODS file |
| Convert to RTF | `rtf` | Transform input data into a table in an RTF file |
| Convert to Text File | `toText` | Transform input data string into a file |
| Convert to XLS | `xls` | Transform input data into an Excel file |
| Convert to XLSX | `xlsx` | Transform input data into an Excel file |
| Move Base64 String to File | `toBinary` | Convert a base64-encoded string into its original file format |

### Parameters

The six spreadsheet operations share one set of parameters and are documented together.

#### Convert to CSV / HTML / RTF / ODS / XLS / XLSX (`csv`, `html`, `rtf`, `ods`, `xls`, `xlsx`)

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| Put Output File in Field | `string` | Yes | `data` | The name of the output binary field to put the file in. Names are case-sensitive — see the upstream node's Binary Data panel for the exact names to use. |
| Options (`options`) | `collection` | No | `{}` | Formatting options for the generated spreadsheet. |
| — Compression | `boolean` | No | `false` | Whether to reduce the output file size. _(shown when Operation is `xlsx`, `ods`)_ |
| — Delimiter | `string` | No | `,` | The character to use to separate fields. _(shown when Operation is `csv`)_ |
| — File Name | `string` | No | — | Name of the output file. |
| — Header Row | `boolean` | No | `true` | Whether the first row of the file contains the header names. |
| — Sheet Name | `string` | No | `Sheet` | Name of the sheet to create in the spreadsheet. _(shown when Operation is `ods`, `xls`, `xlsx`)_ |

#### Convert to JSON (`toJson`)

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| Mode | `options` | No | `once` | Whether to write every input item into one file or give each item its own file. |
| | | | | Options: `once` (all items to one file), `each` (each item to a separate file) |
| Put Output File in Field | `string` | Yes | `data` | The name of the output binary field to put the file in. Names are case-sensitive — see the upstream node's Binary Data panel for the exact names to use. |
| Options (`options`) | `collection` | No | `{}` | Formatting and encoding options for the generated JSON file. |
| — Add Byte Order Mark (BOM) | `boolean` | No | `false` | Whether to add special marker at the start of your text file. This marker helps some programs understand how to read the file correctly. _(shown when Encoding is `utf8`, `cesu8`, `ucs2`)_ |
| — Format | `boolean` | No | `false` | Whether to format the JSON data for easier reading. |
| — Encoding | `options` | No | `utf8` | Choose the character set to use to encode the data. |
| | | | | Options: `armscii8`, `ascii`, `base64`, `big5hkscs`, `binary`, `cesu8`, `cp1046`, `cp1124`, `cp1125`, `cp1129`, `cp1133`, `cp1161`, `cp1162`, `cp1163`, `cp437`, `cp720`, `cp737`, `cp775`, `cp808`, `cp850`, `latin1`, `ucs2`, `utf8` |
| — File Name | `string` | No | — | Name of the output file. |

#### Convert to Text File (`toText`)

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| Text Input Field | `string` | Yes | — | The name of the input field that contains a string to convert to a file. Use dot-notation for deep fields (e.g. 'level1.level2.currentKey'). Names are case-sensitive — see the upstream node's Binary Data panel for the exact names to use. |
| Put Output File in Field | `string` | Yes | `data` | The name of the output binary field to put the file in. Names are case-sensitive — see the upstream node's Binary Data panel for the exact names to use. |
| Options (`options`) | `collection` | No | `{}` | Encoding and naming options for the generated text file. |
| — Add Byte Order Mark (BOM) | `boolean` | No | `false` | Whether to add special marker at the start of your text file. This marker helps some programs understand how to read the file correctly. _(shown when Encoding is `utf8`, `cesu8`, `ucs2`)_ |
| — Encoding | `options` | No | `utf8` | Choose the character set to use to encode the data. |
| | | | | Options: `armscii8`, `ascii`, `base64`, `big5hkscs`, `binary`, `cesu8`, `cp1046`, `cp1124`, `cp1125`, `cp1129`, `cp1133`, `cp1161`, `cp1162`, `cp1163`, `cp437`, `cp720`, `cp737`, `cp775`, `cp808`, `cp850`, `latin1`, `ucs2`, `utf8` |
| — File Name | `string` | No | — | Name of the output file. |

#### Move Base64 String to File (`toBinary`)

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| Base64 Input Field | `string` | Yes | — | The name of the input field that contains the base64 string to convert to a file. Use dot-notation for deep fields (e.g. 'level1.level2.currentKey'). Names are case-sensitive — see the upstream node's Binary Data panel for the exact names to use. |
| Put Output File in Field | `string` | Yes | `data` | The name of the output binary field to put the file in. Names are case-sensitive — see the upstream node's Binary Data panel for the exact names to use. |
| Options (`options`) | `collection` | No | `{}` | Naming and type options for the decoded file. |
| — Add Byte Order Mark (BOM) | `boolean` | No | `false` | Whether to add special marker at the start of your text file. _(shown when Encoding is `utf8`, `cesu8`, `ucs2`)_ |
| — Encoding | `options` | No | `utf8` | Choose the character set to use to encode the data. |
| | | | | Options: `armscii8`, `ascii`, `base64`, `big5hkscs`, `binary`, `cesu8`, `cp1046`, `cp1124`, `cp1125`, `cp1129`, `cp1133`, `cp1161`, `cp1162`, `cp1163`, `cp437`, `cp720`, `cp737`, `cp775`, `cp808`, `cp850`, `latin1`, `ucs2`, `utf8` |
| — File Name | `string` | No | — | Name of the output file. |
| — MIME Type | `string` | No | — | The MIME type of the output file. |

#### Convert to ICS (`iCal`)

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| Event Title | `string` | No | — | The event's summary line. Supports expressions like {{ $json.title }}. |
| Start | `string` | Yes | — | Date and time at which the event begins (ISO 8601). For all-day events, the time will be ignored. |
| End | `string` | Yes | — | Date and time at which the event ends (ISO 8601). For all-day events, the time will be ignored. If not set, will be equal to the start date. |
| All Day | `boolean` | No | `false` | Whether the event lasts all day or not. |
| Put Output File in Field | `string` | Yes | `data` | The field that your iCalendar file will be available under in the output. Names are case-sensitive — see the upstream node's Binary Data panel for the exact names to use. |
| Options (`additionalFields`) | `collection` | No | `{}` | Optional calendar properties written into the event. |
| — Attendees | `fixedCollection` | No | `{}` | People invited to the event. Add one entry per attendee. |
| — — Name | `string` | Yes | — | The attendee's display name. |
| — — Email | `string` | Yes | — | The attendee's email address. |
| — — RSVP | `boolean` | No | `false` | Whether the attendee has to confirm attendance or not. |
| — Busy Status | `options` | No | — | Used to specify busy status for Microsoft applications, like Outlook. |
| | | | | Options: `BUSY`, `TENTATIVE` |
| — Calendar Name | `string` | No | — | Specifies the calendar (not event) name. Used by Apple iCal and Microsoft Outlook. |
| — Description | `string` | No | — | Longer text describing the event. |
| — File Name | `string` | No | — | The name of the file to be generated. Default name is event.ics. |
| — Geolocation | `fixedCollection` | No | `{}` | Coordinates for the event location. One entry only. |
| — — Latitude | `string` | No | — | Latitude of the event location. |
| — — Longitude | `string` | No | — | Longitude of the event location. |
| — Location | `string` | No | — | The intended venue. |
| — Recurrence Rule | `string` | No | — | A rule to define the repeat pattern of the event (RRULE). |
| — Organizer | `fixedCollection` | No | `{}` | Who is hosting the event. One entry only. |
| — — Name | `string` | Yes | — | The organizer's display name. |
| — — Email | `string` | Yes | — | The organizer's email address. |
| — Sequence | `number` | No | `0` | When sending an update for an event (with the same uid), defines the revision sequence number. |
| — Status | `options` | No | `CONFIRMED` | The event's confirmation state. |
| | | | | Options: `CONFIRMED`, `CANCELLED`, `TENTATIVE` |
| — UID | `string` | No | — | Universally unique ID for the event (will be auto-generated if not specified). Should be globally unique. |
| — URL | `string` | No | — | URL associated with event. |

#### All Operations

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| Max Concurrency | `number` | No | `10` | Maximum number of items to process concurrently (used for per-item operations like toJson each, toText, toBinary, iCal). |

## Output Data

This node produces files, not fields. **The output item's `json` is empty** — nothing from the input item's JSON is carried forward, so read any values you still need before this node, or pass them down a parallel branch. The generated file lands on the binary property named by **Put Output File in Field**.

How many items come out depends on the operation:

| Operation | Items out |
|-----------|-----------|
| `csv`, `html`, `rtf`, `ods`, `xls`, `xlsx` | One item for the whole node run — every input item becomes a row in a single file. |
| `toJson` with Mode `once` | One item for the whole node run, holding one file containing an array of every input item's JSON. |
| `toJson` with Mode `each` | One item per input item. |
| `toText`, `toBinary`, `iCal` | One item per input item. |

The per-item operations (`toJson` with Mode `each`, `toText`, `toBinary`, `iCal`) keep the binary properties that arrived on the item and add the new file alongside them. The aggregating operations emit a fresh item that carries only the generated file.

When no **File Name** is set, each operation falls back to a default, and the MIME type is fixed by the format:

| Operation | Default file name | MIME type |
|-----------|-------------------|-----------|
| `csv` | `File.csv` | `text/csv` |
| `html` | `File.html` | `text/html` |
| `rtf` | `File.rtf` | `application/rtf` |
| `ods` | `File.ods` | `application/vnd.oasis.opendocument.spreadsheet` |
| `xls` | `File.xls` | `application/vnd.ms-excel` |
| `xlsx` | `File.xlsx` | `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet` |
| `toJson` | `file.json` | `application/json` |
| `toText` | `file.txt` | `text/plain` |
| `toBinary` | `file` | **MIME Type** if set, otherwise detected from the file name, otherwise `application/octet-stream` |
| `iCal` | `event.ics` | `text/calendar` |

For the spreadsheet operations, nested objects are flattened into dot-notation columns — `{ "address": { "city": "NYC" } }` becomes a column headed `address.city`. Turning **Header Row** off writes the values with no header line.

## Usage Examples

- Convert JSON data to an Excel XLSX file
- Export workflow data to a CSV file with custom delimiter
- Create a JSON file from all input items
- Convert a text string to a .txt binary file
- Generate an ICS calendar event from event data
- Convert a base64-encoded string back to its original binary file

## Example Configuration

Export every input item to one CSV file:

```json
{
  "type": "convert_to_file",
  "parameters": {
    "operation": "csv",
    "binaryPropertyName": "csvFile",
    "options": {
      "delimiter": ",",
      "headerRow": true,
      "fileName": "data_export.csv"
    }
  }
}
```

Build a compressed Excel workbook with a named sheet:

```json
{
  "type": "convert_to_file",
  "parameters": {
    "operation": "xlsx",
    "binaryPropertyName": "excelFile",
    "options": {
      "compression": true,
      "headerRow": true,
      "sheetName": "DataSheet",
      "fileName": "report.xlsx"
    }
  }
}
```

Write all items into a single, pretty-printed JSON file:

```json
{
  "type": "convert_to_file",
  "parameters": {
    "operation": "toJson",
    "mode": "once",
    "binaryPropertyName": "jsonFile",
    "options": {
      "format": true,
      "encoding": "utf8",
      "fileName": "combined_data.json"
    }
  }
}
```

Give each item its own JSON file, numbered by position:

```json
{
  "type": "convert_to_file",
  "parameters": {
    "operation": "toJson",
    "mode": "each",
    "binaryPropertyName": "jsonFiles",
    "options": {
      "format": false,
      "encoding": "utf8",
      "fileName": "item_{{ $index }}.json"
    },
    "maxConcurrency": 5
  }
}
```

Turn a nested string field into a .txt file:

```json
{
  "type": "convert_to_file",
  "parameters": {
    "operation": "toText",
    "sourceProperty": "content.message",
    "binaryPropertyName": "textFile",
    "options": {
      "encoding": "utf8",
      "fileName": "message.txt"
    }
  }
}
```

Decode a base64 string back into a PDF:

```json
{
  "type": "convert_to_file",
  "parameters": {
    "operation": "toBinary",
    "sourceProperty": "attachments.base64Data",
    "binaryPropertyName": "decodedFile",
    "options": {
      "fileName": "document.pdf",
      "mimeType": "application/pdf"
    }
  }
}
```

Generate a calendar invite with an organizer and one attendee:

```json
{
  "type": "convert_to_file",
  "parameters": {
    "operation": "iCal",
    "title": "Team Meeting",
    "start": "2024-01-15T10:00:00Z",
    "end": "2024-01-15T11:00:00Z",
    "allDay": false,
    "binaryPropertyName": "calendarFile",
    "additionalFields": {
      "description": "Weekly team sync meeting",
      "location": "Conference Room A",
      "fileName": "team_meeting.ics",
      "organizerUi": {
        "organizerValues": [
          {
            "name": "John Doe",
            "email": "john@company.com"
          }
        ]
      },
      "attendeesUi": {
        "attendeeValues": [
          {
            "name": "Jane Smith",
            "email": "jane@company.com",
            "rsvp": true
          }
        ]
      }
    }
  }
}
```

Generate an all-day event on a named calendar:

```json
{
  "type": "convert_to_file",
  "parameters": {
    "operation": "iCal",
    "title": "Company Holiday",
    "start": "2024-12-25T00:00:00Z",
    "allDay": true,
    "binaryPropertyName": "holidayEvent",
    "additionalFields": {
      "description": "Christmas Day - Office Closed",
      "calName": "Company Calendar",
      "fileName": "holiday.ics",
      "status": "CONFIRMED"
    }
  }
}
```

### Error Handling

| Mode | Behavior |
|------|----------|
| **stop** | Halts workflow on first error |
| **continue** | Skips failed items, passes successful ones through |
| **errorPort** | Routes failed items to Error output port |

## Tips

Convert JSON data into binary files -- spreadsheets (CSV/XLSX/XLS/ODS/HTML/RTF), JSON files, text files, ICS calendar events, or base64-to-binary conversion.

### Common Patterns

- **Data export pipeline** — use the spreadsheet operations for structured data export with custom formatting and compression options.
- **Document generation** — combine text operations with dynamic content from workflow data to generate reports or documents.
- **Calendar integration** — create calendar events from workflow data, supporting both simple events and complex recurring patterns with attendees.
- **File format conversion** — use `toBinary` for base64 data, or chain operations in sequence for multi-format output.
- **Batch processing** — raise **Max Concurrency** for efficient processing of large datasets, especially with per-item operations like individual JSON files or calendar events.