Skill: Export File

Convert JSON data to CSV or JSON files and deliver them as downloadable links directly in the user's conversation.

The Export File skill converts structured JSON data into a downloadable CSV or JSON file and sends a download link directly to the user’s conversation. Agents use this skill when users need to take data out of Horizon — for import into spreadsheets, further analysis in external tools, or sharing with colleagues.

Parameters

ParameterTypeRequiredDescription
dataarrayYesAn array of objects to export. Each object represents a row (for CSV) or an element (for JSON). All objects should have a consistent set of keys.
formatstringYesThe output file format: "csv" or "json".
filenamestringYesThe name for the exported file, including the file extension (e.g., sales-report.csv, customer-list.json).
Tip

The filename should include the appropriate extension (.csv or .json) matching the format parameter. If the extension does not match, the skill will still use the specified format but the downloaded file may have a misleading extension.

Example usage

Exporting a report as CSV

After pulling a financial report, a user might say:

“Export that profit and loss data as a CSV file I can open in Excel.”

The agent takes the data it received from the Profit & Loss Report skill and invokes Export File with:

  • data: (array of row objects from the P&L report)
  • format: "csv"
  • filename: profit-and-loss-q1-2026.csv

The skill generates the file and returns a download link that the agent shares in the conversation.

Exporting query results as JSON

“Give me a JSON file of all our customers with outstanding balances.”

After querying the data, the agent invokes Export File with:

  • data:
    json
    [
      { "name": "Acme Corp", "balance": 15000.00, "email": "[email protected]" },
      { "name": "Globex Inc", "balance": 7500.50, "email": "[email protected]" }
    ]
  • format: "json"
  • filename: customers-outstanding-balances.json

Exporting site inventory

An agent could combine List Sites with Export File:

“Export a list of all my websites as a spreadsheet.”

The agent calls List Sites, then passes the results to Export File with format: "csv".

Response structure

The skill returns a JSON object with the download link:

json
{
  "filename": "profit-and-loss-q1-2026.csv",
  "format": "csv",
  "download_url": "https://files.horizon.app/exports/abc123/profit-and-loss-q1-2026.csv",
  "row_count": 45,
  "file_size_bytes": 3200,
  "expires_at": "2026-03-25T16:00:00Z"
}
  • filename — the name of the generated file.
  • format — the output format that was used.
  • download_url — a temporary, pre-signed URL for downloading the file.
  • row_count — the number of data rows in the exported file.
  • file_size_bytes — the size of the generated file in bytes.
  • expires_at — ISO 8601 timestamp after which the download link expires.
Caution

Download links are temporary and expire after 7 days. Users should download the file promptly or the agent should inform them of the expiration window.

CSV format details

When exporting as CSV:

  • Headers — the first row contains column headers derived from the keys of the first object in the data array.
  • Column order — columns appear in the order that keys appear in the first data object.
  • Quoting — values containing commas, double quotes, or newlines are automatically quoted per RFC 4180.
  • Nested objects — nested objects and arrays are serialized as JSON strings within the CSV cell. For best results, flatten your data before exporting.
  • Encoding — the file is encoded as UTF-8 with a BOM (byte order mark) for compatibility with Excel.

JSON format details

When exporting as JSON:

  • Structure — the file contains the data array as-is, pretty-printed with 2-space indentation.
  • Encoding — the file is encoded as UTF-8.
  • Nested data — nested objects and arrays are preserved in their original structure.

Behavior notes

  • Data size limit — the data array is limited to 50,000 rows. Larger datasets should be broken into multiple exports.
  • File size limit — generated files are capped at 25 MB. If the data exceeds this limit, the skill returns an error suggesting the user narrow the dataset.
  • Consistent keys — for CSV exports, all objects in the data array should have the same set of keys. Missing keys in some objects will result in empty cells for those columns.
  • Conversation delivery — the download link is automatically rendered as a clickable file attachment in the user’s conversation interface. The user does not need to copy-paste URLs.
  • No overwrite — each export generates a unique file. Exporting with the same filename creates a new file rather than overwriting a previous one.
Note

This skill does not store data permanently. The exported file is available for download for 7 days, after which it is automatically deleted from storage.


Related skills: Get Skill | Create Skill