Why Use XLS to JSON API?

Preserves Layout

Using our XLS to JSON API, you can convert XLS to JSON while preserving the layout of your XLS file.

No Licenses Required

Here at PDF.co Web API platform, there’s no need to purchase any license to use our APIs. You only need to get either a subscription plan or top-up non-expiring credits.

Lots of Integrations to Choose from

PDF.co Web API platform has a lot of integrations available. Starting with Zapier, Integromat, BluePrism, UiPath, Automation Anywhere, and 300+ more.

Enterprise Solutions

For enterprise customers, there is a Dedicated API Server that runs as a dedicated private server with dedicated private cloud storage in the hosting region of your choice.

XLS to JSON API Sample & Demo

We prepare this sample XLS file for this demo.

Screenshot of Sample XLS
Screenshot of Sample XLS

The code snippets below are in different programming languages. Using those code snippets, you can convert the sample XLS file above into a JSON file.

The result would look like this.

[
{
"Column0": "Customer Name",
"Column1": "Book Name",
"Column2": "Password",
"Column3": null
},
{
"Column0": "John Doe",
"Column1": "Book of Lfe",
"Column2": "password",
"Column3": null
}
]

Before we proceed with the code. Let us first check the /v1/xls/convert/to/json parameters and its uses.

Endpoint

URL: https://api.pdf.co/v1/xls/convert/to/json
Method: POST
Parameter Description
url required. Link to the source file.
expiration optional. Output link expiration in minutes. Default is 60 (i.e. 60 minutes or 1 hour). After this delay generated output file(s) (if any) will be auto-removed from PDF.co temporary files storage. Max allowed expiration period depends on your current subscription plan. To store permanent input files (e.g. re-usable images, pdf, documents), please use PDF.co built-in Files Storage instead.
inline optional. Must be one of: true to return data as inline or false to return link to the output file (default).
worksheetIndex optional. index of worksheet to use.
encrypt optional. Enable encryption for the output file: true or false
async optional. Runs processing asynchronously. Returns jobId to use with job/checktrue or false
name optional. Output file name.
profiles optional. Must be a String. Set custom configuration. See profiles examples here

Now we are ready to write some codes.

cURL Code Snippet

curl --location --request POST 'https://api.pdf.co/v1/xls/convert/to/json' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"url": "https://docs.google.com/spreadsheets/d/1lqMC7VOXYTGmyuxAbCvaSD6g_q8-yElMAfria7NqpME/edit#gid=0"
}'

This sample code and other cURL source source code samples are available here.

Now let’s see this program in action.

Output JSON using cURL
Output JSON using cURL

The sample code for XLS to JSON in JavaScript is located here.