# Data Format Converter — CSV, JSON, JSONL & Excel (XLSX) (`openregistry/data-format-converter`) Actor

Convert files by URL between CSV, JSON, JSONL and Excel XLSX in bulk. Auto-detects the CSV delimiter (comma, semicolon, tab, pipe) and encoding, flattens nested JSON into columns, keeps leading zeros. Download link for each converted file. Pay per file.

- **URL**: https://apify.com/openregistry/data-format-converter.md
- **Developed by:** [Mahé Perrin](https://apify.com/openregistry) (community)
- **Categories:** Developer tools, Integrations
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$2.00 / 1,000 file converteds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Data Format Converter — CSV, JSON, JSONL & Excel (XLSX)

Convert data files between **CSV, JSON, JSONL (NDJSON) and Excel XLSX** in bulk, straight from their URLs. Each converted file gets a download link. No upload form, no file-size games, works from the API, Make, Zapier or n8n.

What it handles for you:

- **CSV delimiter detection**: comma, semicolon (European Excel exports), tab, pipe — quotes respected.
- **Encoding**: UTF-8 (with or without BOM) and old Windows-1252 exports; output CSV is UTF-8 with BOM so Excel shows accents correctly.
- **Nested JSON → columns**: `{"address": {"city": "Paris"}}` becomes an `address.city` column; arrays are kept as JSON text.
- **API responses**: a JSON object wrapping one array (`{"data": [...]}`, `{"items": [...]}`) is unwrapped automatically.
- **Careful typing**: CSV/XLSX → JSON turns `"12"` into `12` and `"true"` into `true`, but **keeps leading zeros** (ZIP codes, product IDs) as text.
- **Excel input**: formulas give their computed value, links their text, dates come out in ISO 8601; pick the sheet by name or number.
- **Excel output**: bold, frozen header row, sensible column widths.

### What it is for

- Turn an API's JSON export into a spreadsheet your team can open.
- Feed an Excel file from a client into a pipeline that wants JSONL.
- Normalize semicolon CSVs from European tools into standard comma CSV (or the reverse).
- Convert an Apify dataset export, a database dump or a BI export without writing a script.

### Input example

```json
{
  "files": [
    "https://raw.githubusercontent.com/datasets/country-codes/main/data/country-codes.csv",
    "https://example.com/exports/orders.json"
  ],
  "outputFormat": "xlsx",
  "csvDelimiter": "auto",
  "flattenNested": true
}
```

- `files` — public links; each file is converted separately.
- `outputFormat` — `csv`, `json`, `jsonl` or `xlsx`.
- `inputFormat` — `auto` (default), or force `csv`, `tsv`, `json`, `jsonl`, `xlsx`.
- `csvDelimiter` / `outputDelimiter` — input detection or forced value; output delimiter for CSV.
- `hasHeader`, `inferTypes`, `flattenNested`, `sheet`, `maxFileSizeMb` — fine-tuning (see the input tab).

### Output example (real result)

One dataset row per file; the converted files are in the run's key-value store.

```json
{
  "sourceUrl": "https://raw.githubusercontent.com/datasets/country-codes/main/data/country-codes.csv",
  "sourceFormat": "csv",
  "detectedDelimiter": ",",
  "encoding": "utf-8",
  "outputFormat": "xlsx",
  "rowCount": 249,
  "columnCount": 56,
  "columns": ["FIFA", "Dial", "ISO3166-1-Alpha-3", "MARC", "..."],
  "sourceSizeBytes": 133991,
  "outputUrl": "https://api.apify.com/v2/key-value-stores/<store-id>/records/converted-0001-country-codes.xlsx?signature=<signature>",
  "outputKey": "converted-0001-country-codes.xlsx",
  "outputSizeBytes": 94658,
  "error": null
}
```

### Honest limits

- Old binary `.xls`, `.ods`, XML and Parquet are not supported (yet).
- Excel output stops at Excel's own limit of 1,048,576 rows; choose CSV or JSONL beyond that. Cells longer than 32,767 characters are cut (Excel limit).
- Files are processed in memory: up to 200 MB per file; give the run more memory for files above 50 MB.
- Formatting, charts and merged cells of an input XLSX are not carried over: only the values are.
- Download links are signed (they open without an Apify token) and live as long as the run's storage (data retention of your plan, 7 days on the free plan).

### Privacy

Your files are only read to convert them and the results stay in your own Apify storage.

### Pricing

**$0.002 per file converted** ($2 per 1,000 files), whatever its size within the limits. Files that fail (broken link, invalid JSON, too big) return an `error` row and are **not charged**. Set a maximum charge per run in the Apify console and the Actor stops cleanly when it is reached.

# Actor input Schema

## `files` (type: `array`):

Public links to CSV, TSV, JSON, JSONL/NDJSON or XLSX files. Each file is converted separately.

## `outputFormat` (type: `string`):

Target format for every file.

## `inputFormat` (type: `string`):

Detection uses the file signature, extension and content type.

## `csvDelimiter` (type: `string`):

European Excel exports usually use semicolons; detection handles it.

## `outputDelimiter` (type: `string`):

Only used when converting to CSV.

## `hasHeader` (type: `boolean`):

CSV and XLSX input. When off, columns are named column_1, column_2...

## `inferTypes` (type: `boolean`):

CSV/XLSX → JSON: "12" becomes 12, "true" becomes true, empty becomes null. Values with leading zeros (ZIP codes, IDs) stay text.

## `flattenNested` (type: `boolean`):

JSON → CSV/XLSX: {"user":{"name":"A"}} becomes a user.name column; arrays are kept as JSON text.

## `sheet` (type: `string`):

Sheet name or number (1 = first). Default: first sheet.

## `maxFileSizeMb` (type: `integer`):

Bigger files are skipped with an error row (not charged). Give the run more memory for files above 50 MB.

## Actor input object example

```json
{
  "files": [
    "https://raw.githubusercontent.com/datasets/country-codes/main/data/country-codes.csv"
  ],
  "outputFormat": "xlsx",
  "inputFormat": "auto",
  "csvDelimiter": "auto",
  "outputDelimiter": ",",
  "hasHeader": true,
  "inferTypes": true,
  "flattenNested": true,
  "maxFileSizeMb": 50
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `files` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "files": [
        "https://raw.githubusercontent.com/datasets/country-codes/main/data/country-codes.csv"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("openregistry/data-format-converter").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "files": ["https://raw.githubusercontent.com/datasets/country-codes/main/data/country-codes.csv"] }

# Run the Actor and wait for it to finish
run = client.actor("openregistry/data-format-converter").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "files": [
    "https://raw.githubusercontent.com/datasets/country-codes/main/data/country-codes.csv"
  ]
}' |
apify call openregistry/data-format-converter --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,openregistry/data-format-converter"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/T0XPhUCxbXcKqqUAE/builds/JVIEj5kLyA5JIAK0D/openapi.json
