---
title: "Convert JSON to an Excel file"
method: POST
path: "/json-to-excel"
tags: ["Documents"]
---

# Convert JSON to an Excel file

`POST /json-to-excel`

## Request

- Base URL: `https://api.cofferdock.com`
- URL: `https://api.cofferdock.com/json-to-excel`
- Auth: API key in header `x-api-key`

Turns an array of objects into a real .xlsx workbook, one sheet, columns taken from the union of every object's keys. Up to 100,000 rows and 1,000 columns (and 2 million cells, rows x columns). If the data contains content you do not control (form answers, emails, web pages), set escape_formulas to true: a value sent as an object such as {"formula":"1+1"} would otherwise be saved as a real formula, and text starting with = + - @ could be read as a formula in another program.

Costs 1 credit per call.

## Request body

- object
  - `data` object[], required: The rows for the spreadsheet: a non-empty array of objects (up to 100000), e.g. [{"name":"Ana","age":30}]. The columns are every key found in any object, in order of first appearance.
  - `sheet_name` string: Name of the worksheet. Default "Sheet1". Up to 31 characters (longer names are cut); it cannot contain * ? : \ / [ ], start or end with an apostrophe, or be "History" (a name with any of those returns a 400 error).
  - `header` boolean: true (default) = the first row holds the column names; false = data rows only.
  - `escape_formulas` boolean: true = keep the data from turning into formulas, links or error cells: a value sent as an object or list (for example {"formula":"1+1"} or {"text":"x","hyperlink":"https://example.com"}, which would otherwise be saved as a real formula or link) is written as its JSON text, and every text value (and every column name) that starts with =, +, -, @, a tab or a carriage return gets a single quote added in front ("=1+1" is written as "'=1+1"). JSON numbers and booleans are never changed. false = write the values exactly as received. Use true whenever the data includes content you do not control (form answers, emails, web pages); with it on you cannot send real formulas in data.
  - `output` 'json' | 'xlsx' | 'binary' | 'url': How to return the workbook: "json" (default: base64 in the JSON response), "xlsx" or "binary" (the .xlsx file itself as the response body; both do the same) or "url" (a temporary download link, valid 15 minutes).

## Response `200`

Result.

- object
  - `success` boolean
  - `xlsx` string, byte
  - `meta` object
    - `rows` integer
    - `columns` integer
    - `used` integer: Credits used this month, after this call.
    - `remaining` integer, nullable: Credits left this month (null = unlimited).
    - `unlimited` boolean

## Other responses

- `400`: Invalid input (nothing is charged).
- `401`: Missing or invalid API key.
- `403`: Email not verified.
- `429`: Monthly credit limit reached, or too many requests per minute for this key (see Retry-After).
- `503`: Server busy (queue full). Retry after the seconds in the Retry-After header.

---

[API](https://skmtc.dev/cofferdock/apis/cofferdock-api.md) · [All operations](https://skmtc.dev/cofferdock/apis/cofferdock-api/llms.txt) · [OpenAPI document](https://skmtc.dev/cofferdock/apis/cofferdock-api/revisions/b57aa000d33a?raw)
