XLS to JSON API - Convert XLS File to JSON with PDF.co

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, Make, BluePrism, UiPath, Automation Anywhere, and 300+ more.

XLS to JSON API Sample & Demo

We prepared 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

Parameters with 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 File 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 at our documentation.

Now we are ready to write some code.

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 at our documentation.

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 at our documentation.