Call the API
Obtain an API token to be used on your server
Create an account on the API dashboard and get your first API key.
This API key is a secret, do not disclose it on your app frontend.
The usage is not limited yet, but it will be in the future, with a SaaS subscription model (pricing to be defined, related to usage of the API).
Call the API and retreive a download link
From your server, you can now call the API to blend your JSON data into your XLSX template.
import fetch from 'node-fetch'
// see related documentation on how to prepare jsonObject variable
const jsonString = JSON.stringify(jsonObject)
// prepare the JSON object
const response = await fetch("https://api.jsontoxlsx.com/generate", {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": "<your-api-key>"
},
body: jsonString
});
const data = await response.json();
console.log(data)
/**
data = {
status: 'ok',
downloadUrl: 'https://api.jsontoxlsx.com/download/<random_id>'
}
*/
The download URL data.downloadUrl
is valid for a single download. Once the file is downloaded, it is deleted from the server. We don't keep history of the generated files.
Final file
The generated file looks like the following: Export-contacts.xlsx