# JSON to CSV & Excel Converter (Datasets, URLs) (`klyve1/json-csv-excel-converter`) Actor

Convert JSON, JSON Lines, CSV or an Apify dataset into CSV, Excel XLSX or JSON. Flattens nested objects, picks and renames columns, and saves a ready to download file.

- **URL**: https://apify.com/klyve1/json-csv-excel-converter.md
- **Developed by:** [Nico Klyve](https://apify.com/klyve1) (community)
- **Categories:** Developer tools, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 1,000 rows 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

## JSON to CSV & Excel Converter (Datasets, URLs)

Turn JSON into a clean spreadsheet in one click. Convert an **Apify dataset**, JSON, JSON Lines or CSV files from any URL, or pasted JSON into **CSV, Excel XLSX, flattened JSON or JSON Lines**. Nested objects become columns like `address.city`, lists become readable cells, and you choose, reorder and rename the columns. The file is saved in the run's key-value store with a direct download link.

### Who uses it

- **Apify users**: convert the output of any scraper into an Excel file with your own column names, then send it to a client.
- **Analysts**: flatten API responses for Excel, Google Sheets or Power BI.
- **Automation builders (Make, Zapier, n8n)**: chain it after another Actor to deliver a ready file.
- **Anyone with a CSV**: switch delimiters (comma, semicolon for French or German Excel, tab) or convert CSV to JSON.

### Example output

The dataset gets one summary row, the file goes to the key-value store:

```json
{
  "file": "output.xlsx",
  "format": "xlsx",
  "downloadUrl": "https://api.apify.com/v2/key-value-stores/<storeId>/records/output.xlsx",
  "rows": 3,
  "columns": 6,
  "columnNames": ["name", "url", "address.city", "address.country", "tags", "rating"],
  "sizeBytes": 6870,
  "preview": [
    { "name": "Apify", "url": "https://apify.com", "address.city": "Prague", "address.country": "CZ", "tags": "scraping, automation", "rating": 4.8 }
  ]
}
```

### Input

| Field | Description |
|---|---|
| Apify dataset ID | A dataset to convert, for example the default dataset of another run. |
| Data file URLs | JSON, JSON Lines or CSV files on the web. |
| JSON data | Paste an array of objects. |
| Output format | CSV, Excel (XLSX), JSON (flattened) or JSON Lines. |
| Flatten nested objects | `address.city` columns (on by default). |
| Arrays | Join values in one cell, or one column per item. |
| Columns to keep / remove | Pick and order columns, `prefix.*` for groups. |
| Rename columns | `{"address.city": "City"}`. |
| CSV delimiter | comma, semicolon or tab. CSV files are written in UTF-8 with BOM so Excel shows accents correctly. |
| File name / sheet name / max rows | Output settings. |

### Pricing

Pay per use: **$0.002 per 1,000 rows** converted (any file counts as at least 1,000 rows). Failed runs are free.

### Good to know

- Excel header row is bold, frozen and has filters. Cells over 32,000 characters are cut (Excel limit).
- Datasets of other users are readable only if they are public.
- Files up to 200 MB per URL.

# Actor input Schema

## `datasetId` (type: `string`):

ID or name of an Apify dataset to convert (for example the default dataset of another Actor run). Your own datasets and public datasets work.

## `dataUrls` (type: `array`):

Links to JSON, JSON Lines or CSV files, one per line. Rows of all files are combined.

## `jsonData` (type: `array`):

Paste an array of JSON objects to convert directly.

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

File format to produce.

## `flatten` (type: `boolean`):

Turn nested objects into columns like address.city. Turn off to keep JSON text in cells.

## `arrayMode` (type: `string`):

Join: lists of values become one cell separated by commas. Columns: each item gets its own column (tags.0, tags.1...).

## `fields` (type: `array`):

Optional list of columns, in the order you want. Use a trailing \* for groups (address.\*). Empty keeps every column.

## `omitFields` (type: `array`):

Columns to drop. A trailing \* removes a group.

## `renameFields` (type: `object`):

Map of old column name to new name, for example {"address.city": "City"}.

## `delimiter` (type: `string`):

Comma is standard. Semicolon opens directly in Excel with French or German settings.

## `fileName` (type: `string`):

Name of the produced file, without extension.

## `sheetName` (type: `string`):

Name of the worksheet in the XLSX file.

## `maxRows` (type: `integer`):

Stop after this many rows. 0 means no limit.

## Actor input object example

```json
{
  "jsonData": [
    {
      "name": "Apify",
      "url": "https://apify.com",
      "address": {
        "city": "Prague",
        "country": "CZ"
      },
      "tags": [
        "scraping",
        "automation"
      ],
      "rating": 4.8
    },
    {
      "name": "Wikipedia",
      "url": "https://www.wikipedia.org",
      "address": {
        "city": "San Francisco",
        "country": "US"
      },
      "tags": [
        "encyclopedia"
      ],
      "rating": 4.9
    },
    {
      "name": "OpenStreetMap",
      "url": "https://www.openstreetmap.org",
      "address": {
        "city": "Cambridge",
        "country": "GB"
      },
      "tags": [
        "maps",
        "open data"
      ],
      "rating": 4.7
    }
  ],
  "outputFormat": "xlsx",
  "flatten": true,
  "arrayMode": "join",
  "delimiter": "comma",
  "fileName": "output",
  "sheetName": "Data",
  "maxRows": 0
}
```

# Actor output Schema

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

All rows produced by the run.

# 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 = {
    "jsonData": [
        {
            "name": "Apify",
            "url": "https://apify.com",
            "address": {
                "city": "Prague",
                "country": "CZ"
            },
            "tags": [
                "scraping",
                "automation"
            ],
            "rating": 4.8
        },
        {
            "name": "Wikipedia",
            "url": "https://www.wikipedia.org",
            "address": {
                "city": "San Francisco",
                "country": "US"
            },
            "tags": [
                "encyclopedia"
            ],
            "rating": 4.9
        },
        {
            "name": "OpenStreetMap",
            "url": "https://www.openstreetmap.org",
            "address": {
                "city": "Cambridge",
                "country": "GB"
            },
            "tags": [
                "maps",
                "open data"
            ],
            "rating": 4.7
        }
    ],
    "outputFormat": "xlsx"
};

// Run the Actor and wait for it to finish
const run = await client.actor("klyve1/json-csv-excel-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 = {
    "jsonData": [
        {
            "name": "Apify",
            "url": "https://apify.com",
            "address": {
                "city": "Prague",
                "country": "CZ",
            },
            "tags": [
                "scraping",
                "automation",
            ],
            "rating": 4.8,
        },
        {
            "name": "Wikipedia",
            "url": "https://www.wikipedia.org",
            "address": {
                "city": "San Francisco",
                "country": "US",
            },
            "tags": ["encyclopedia"],
            "rating": 4.9,
        },
        {
            "name": "OpenStreetMap",
            "url": "https://www.openstreetmap.org",
            "address": {
                "city": "Cambridge",
                "country": "GB",
            },
            "tags": [
                "maps",
                "open data",
            ],
            "rating": 4.7,
        },
    ],
    "outputFormat": "xlsx",
}

# Run the Actor and wait for it to finish
run = client.actor("klyve1/json-csv-excel-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 '{
  "jsonData": [
    {
      "name": "Apify",
      "url": "https://apify.com",
      "address": {
        "city": "Prague",
        "country": "CZ"
      },
      "tags": [
        "scraping",
        "automation"
      ],
      "rating": 4.8
    },
    {
      "name": "Wikipedia",
      "url": "https://www.wikipedia.org",
      "address": {
        "city": "San Francisco",
        "country": "US"
      },
      "tags": [
        "encyclopedia"
      ],
      "rating": 4.9
    },
    {
      "name": "OpenStreetMap",
      "url": "https://www.openstreetmap.org",
      "address": {
        "city": "Cambridge",
        "country": "GB"
      },
      "tags": [
        "maps",
        "open data"
      ],
      "rating": 4.7
    }
  ],
  "outputFormat": "xlsx"
}' |
apify call klyve1/json-csv-excel-converter --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,klyve1/json-csv-excel-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/tntwwMvZF0AytvdOB/builds/DX253Yl3vjJY8eiIm/openapi.json
