Getting started


To begin using the Api you'll first need to obtain an API key.If you subscribed through Rapid Api you can follow these steps. If you subscribed directly you can obtain your Api key with the following steps.


Once you have your Api key your ready to start transforming JSON to an Excel document.The authentication section describes how to authenticate with the Api. Making requests provides a step by step guide on how to send requests to the Api.


Browse the response section to view the response object.


Authentication


The Api has two authentication methods. One for users who have subscribed through RapidApi and another for users who have subscribed directly through this site via a subscription. The following few sections describe authentication for the two authentication methods.


JSON to Excel authentication


Authenication with the api involves setting the X-API-Key header.


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

X-API-Key

7f30b789-3e6a-4b10-aa5a-68b8c6fcb762

RapidApi authentication


Authenication with the api 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.

x-rapidapi-key

5b33af5fc46c4c18b738e000f8507174

Expected format


Example to create an Excel file called employees.xlsx. Note you do not need to supply the file extension in the filename. The only required field is rows. Which can be an array or object.

{
  "rows": [
    {
      "name": "john",
      "role": "admin",
      "age": 37
    },
    {
      "name": "steven",
      "role": "sales admin",
      "age": 36
    }
  ]
}

Response


Returns a presigned URL valid for 5 mins.

{
  "url": "https://s3.eu-west-2.amazonaws.com/json-to-excel-rapid-api/dev/employees.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"
}

This code snippet will trigger a download using javascript in the browser:

window.location = response.url;

Nested structures


Nested structures are supported. Including objects and arrays, the examples are all valid and can be intermixed.

{
  "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


The Api accepts a number of optional paramaters. These are not required. The optional paramaters are listed bellow.


Order


Explicitly define the column order.

{
  "order": {
     "nested_object.id": 0,
     "name": 1,
     "role": 2,
     "age": 3,
  }
}
Example
{
  "filename": "employees",
  "order": {
    "nested_object.id": 0,
    "name": 1,
    "role": 2,
    "age": 3
  },
  "rows": [
    {
      "name": "john",
      "role": "admin",
      "age": 37
    },
    {
      "name": "steven",
      "role": "sales admin",
      "age": 36,
      "nested_object": {
        "id": "1d843906-00e9-4c5c-8dcc-f2735e2103bc"
      }
    }
  ]
}

Filename


Set the filename. If not set a random uuid will be used as the filename
{
  "filename": "employees"
}
Example
{
  "filename": "employees",
  "rows": [
    {
      "name": "john",
      "role": "admin",
      "age": 37
    },
    {
      "name": "steven",
      "role": "sales admin",
      "age": 36
    }
  ],
}

Sheetname


Set the sheetname
{
  "sheetname": "Employee details"
}

Making requests


All endpoints are expected to be requested via a POST request.


Set the header Content-Type to application/json.


The Api endpoint varries depending on how you subscribed to the Api. If your subscription is direct through this site please follow the JSON to Excel endpoint instructions.


Alternatively if your subscription is via RapidApi please follow the RapidApi endpoint instructions.


JSON to Excel endpoint


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


Here are some example POST requests to the Api in various languages

javascript

const data = JSON.stringify({
  filename: "employees",
  rows: [
    {
      name: "john",
      role: "admin",
      age: 37,
    },
    {
      name: "steven",
      role: "sales admin",
      age: 36,
    },
  ],
  order: {
    name: 0,
    role: 1,
    age: 2,
  },
});

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://www.json-to-excel.com");
xhr.setRequestHeader("X-API-Key", "5b33af5fc46c4c18b738e000f8507174");
xhr.setRequestHeader("Content-Type", "application/json");

xhr.send(data);

nodejs

const http = require("https");

const options = {
  method: "POST",
  hostname: " https://www.json-to-excel.com",
  port: null,
  path: "/",
  headers: {
    "X-API-Key": "5b33af5fc46c4c18b738e000f8507174",
    "Content-Type": "application/json",
  },
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(
  JSON.stringify({
    filename: "employees",
    rows: [
      {
        name: "john",
        role: "admin",
        age: 37,
      },
      {
        name: "steven",
        role: "sales admin",
        age: 36,
      },
    ],
    order: {
      name: 0,
      role: 1,
      age: 2,
    },
  }),
);
req.end();

RapidApi endpoint


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


For additional instructions refer to the instructions on RapidApi.