API documentation

Convert JSON payloads into Excel workbooks

Use the JSON to Excel API to send structured JSON and receive a temporary download URL for a generated XLSX or CSV file.

Getting started


Send a POST request with JSON in the body. The API turns the supplied rows into an XLSX or CSV file and returns a temporary download URL.

Direct accounts use an API key from the dashboard. RapidAPI users should use the RapidAPI key from their app. Both paths are covered in the authentication section.

The minimum valid request contains only rows. Use optional fields when you want to control the workbook filename, worksheet name, column order, or generate CSV instead of XLSX.


Authentication


Authentication depends on where you subscribed. Use the direct API key from this site when calling https://json-to-excel.com. Use your RapidAPI key when calling the RapidAPI endpoint.


JSON to Excel authentication


Authentication with the direct API involves setting the X-API-Key header.

To obtain your X-API-Key header value log in to the site and go to your dashboard. Your X-API-Key will be displayed along with usage.

Header

X-API-Key: 7f30b789-3e6a-4b10-aa5a-68b8c6fcb762

RapidAPI authentication


Authentication through RapidAPI involves setting the x-rapidapi-key header.

To obtain your RapidAPI authentication header value, go to the endpoint on RapidAPI and view the App tab to copy your individual auth token.

Header

x-rapidapi-key: 5b33af5fc46c4c18b738e000f8507174

Expected format


The only required field is rows. It can be an array of objects or a single object. If you do not provide a filename, the generated workbook will use an automatic UUID filename.

{
  "rows": [
    {
      "order_id": "ORD-1001",
      "customer": "Acme Operations",
      "total": 149.99
    },
    {
      "order_id": "ORD-1002",
      "customer": "Northwind Analytics",
      "total": 89.5
    }
  ]
}

Field reference


Field Required Type Description
rows Yes Array or object The JSON data to convert into worksheet rows.
filename No String Workbook filename without the .xlsx extension.
sheetname No String Name for the worksheet tab inside the workbook.
order No Object Map field paths to zero-based column positions.
rawFile No Boolean Return the generated XLSX file directly instead of a JSON response containing a download URL.
csv No Boolean Generate a CSV file instead of an XLSX workbook.
multiTable No Boolean Generate separate XLSX sheets for nested object and array relationships. Relationship sheets include _parent links back to the parent row.

Response


A successful request returns a JSON object containing a pre-signed download URL. The URL is valid for 5 minutes. Set csv to true to generate a CSV file URL instead of an XLSX file URL. Set rawFile to true to return the generated file directly.

{
  "url": "https://s3.eu-west-2.amazonaws.com/json-to-excel-rapid-api/dev/7f30b789-3e6a-4b10-aa5a-68b8c6fcb762.xlsx?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIA45OIHTVPVKWWDIRC%2F20240901%2Feu-west-2%2Fs3%2Faws4_request&X-Amz-Date=20240901T175355Z&X-Amz-Expires=300&X-Amz-SignedHeaders=host&X-Amz-Signature=9b4ebaf3ba0158f3c5182e795b8455fe5ca680bcdfe5e76d66a94853ce08e3e0"
}

In browser code, redirecting to the returned URL starts the workbook download:

window.location = response.url;

Raw file responses use Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet for XLSX files or Content-Type: text/csv; charset=utf-8 for CSV files, plus Content-Disposition: attachment. Add csv to a raw file request to return CSV bytes instead of XLSX bytes.

{
  "rows": [
    {
      "order_id": "ORD-1001",
      "customer": "Acme Operations",
      "total": 149.99
    }
  ],
  "rawFile": true
}
Raw CSV example
{
  "rows": [
    {
      "order_id": "ORD-1001",
      "customer": "Acme Operations",
      "total": 149.99
    }
  ],
  "rawFile": true,
  "csv": true
}

Nested structures


Nested structures are supported. Nested object fields become path-like columns, and arrays are flattened so deeply nested API responses can still be exported. Object paths use dot notation, such as customer.name. Array paths put the index before the child field, such as items.0.sku.

{
  "rows": [
    {
      "id": "03e02566-cea6-4c24-8cef-a084e30d99a2",
      "object": {
        "nested_": {
          "id": "c9ff2782-38c3-4ba2-a9e9-2a6d60090038",
          "deeply_nested_object": {
            "id": "6e750787-7105-42d1-8be6-82e7f980ef71"
          }
        }
      },
      "array": [
        {
          "id": "3aa0bf70-001c-4f21-8aa1-b4a7de5f5a31",
          "deeply_nested_array_ids": [
            "0f9fdb29-0821-4065-9b99-b6b89407e29c"
          ]
        }
      ]
    }
  ]
}

Optional parameters


Optional parameters can be included alongside rows to control the generated workbook.


Order


Explicitly define column order. Use dot notation for nested fields. For arrays, place the index before the child field: items.0.sku. Values are zero-based, so 0 is the first column. Negative values count from the end: -1 is the last column and -2 is the second-last column.

{
  "order": {
     "nested_object.id": 0,
     "items.0.sku": 1,
     "name": 2,
     "role": -2,
     "age": -1
  }
}
Example
{
  "filename": "orders",
  "order": {
    "order_id": 0,
    "customer.name": 1,
    "items.0.sku": 2,
    "total": -1
  },
  "rows": [
    {
      "order_id": "ORD-1001",
      "customer": {
        "name": "Acme Operations"
      },
      "items": [
        {
          "sku": "API-EXPORT"
        }
      ],
      "total": 149.99
    }
  ]
}

Filename


Set the workbook filename without the .xlsx extension. If omitted, the API uses an automatic UUID filename.
{
  "filename": "orders"
}
Example
{
  "filename": "orders",
  "rows": [
    {
      "order_id": "ORD-1001",
      "customer": "Acme Operations",
      "total": 149.99
    }
  ]
}

Sheetname


Set the worksheet tab name. If omitted, the API uses its default sheet name.
{
  "sheetname": "January"
}

Rawfile


Set rawFile to true when you want the API response body to be the generated XLSX file. When omitted or set to false, the API returns the standard JSON response with a temporary download URL.
{
  "rawFile": true,
  "filename": "orders",
  "rows": [
    {
      "order_id": "ORD-1001",
      "customer": "Acme Operations",
      "total": 149.99
    }
  ]
}

CSV


Set csv to true when you want the API to generate a CSV file instead of an XLSX workbook. By default, the response is still JSON containing a temporary download URL. Add rawFile when you want the CSV returned directly as a file attachment.
{
  "csv": true,
  "filename": "orders",
  "rows": [
    {
      "order_id": "ORD-1001",
      "customer": "Acme Operations",
      "total": 149.99
    }
  ]
}


Multi-table


Set multiTable to true to create an XLSX workbook with separate sheets for nested object and array relationships instead of flattening everything into one row. Each sheet includes a generated internal _id column, which is hidden in the workbook by default. Relationship sheets also include _parent, which links each child row back to its parent row.

The visible _parent link text uses the parent row's own id when available, then a localized name field, then title, and finally the generated internal ID. Supported name fields are name, nombre, nom, nome, naam, namn, navn, nazwa, isim, and nazev.

Link-only wrapper objects are skipped. For example, charges: { data: [...] } creates a charges.data sheet and links those rows directly to the nearest parent row with data, rather than creating an empty charges sheet.

multiTable is only available for XLSX output and cannot be combined with csv.

{
  "multiTable": true,
  "filename": "users",
  "sheetname": "Users",
  "rows": [
    {
      "user": {
        "count": 2,
        "ref": "/ref/sales",
        "names": [
          { "id": 1, "name": "chris" },
          { "id": 2, "name": "adam" }
        ]
      }
    }
  ]
}

Making requests


Send requests with POST and Content-Type: application/json.

Use the direct endpoint if you created an account on this site. Use the RapidAPI endpoint if your subscription is managed through RapidAPI.


JSON to Excel endpoint


Submit a POST request to https://json-to-excel.com/.

curl

curl -X POST "https://json-to-excel.com/" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: 5b33af5fc46c4c18b738e000f8507174" \
  -d '{
    "filename": "orders",
    "sheetname": "January",
    "rows": [
      {
        "order_id": "ORD-1001",
        "customer": "Acme Operations",
        "total": 149.99
      }
    ]
  }'

JavaScript fetch

const response = await fetch("https://json-to-excel.com/", {
  method: "POST",
  headers: {
    "X-API-Key": "5b33af5fc46c4c18b738e000f8507174",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    filename: "orders",
    rows: [
      {
        order_id: "ORD-1001",
        customer: "Acme Operations",
        total: 149.99,
      },
    ],
  }),
});

const data = await response.json();

if (!response.ok) {
  throw new Error(data.error || "Conversion failed");
}

window.location = data.url;

RapidAPI endpoint


Submit a POST request to https://json-to-excel.p.rapidapi.com/.

RapidAPI injects gateway headers for your app. Follow the RapidAPI instructions for the exact headers and code snippets for your account.


Errors


Error responses return JSON with an error message. Common status codes are:

Status Meaning
400 The JSON body is invalid or the request format is not supported.
401 The API key is missing or invalid.
429 Your plan request limit has been reached.
500 The conversion failed unexpectedly. Retry or contact support if it persists.
{
  "error": "Missing or invalid API key"
}