Convert Excel#

/xls/convert/to/csv#

Converts a xls/xlsx file to csv.

  • Method: POST

  • Endpoint: /v1/xls/convert/to/csv

/xls/convert/to/json#

Converts a xls/xlsx/csv file to json.

  • Method: POST

  • Endpoint: /v1/xls/convert/to/json

/xls/convert/to/html#

Converts a xls/xlsx/csv file to html.

  • Method: POST

  • Endpoint: /v1/xls/convert/to/html

/xls/convert/to/txt#

Converts a xls/xlsx/csv file to txt.

  • Method: POST

  • Endpoint: /v1/xls/convert/to/txt

/xls/convert/to/xml#

Converts a xls/xlsx/csv file to xml.

  • Method: POST

  • Endpoint: /v1/xls/convert/to/xml

/xls/convert/to/pdf#

Converts a xls/xlsx/csv file to pdf.

  • Method: POST

  • Endpoint: /v1/xls/convert/to/pdf

Attributes#

Note

Attributes are case-sensitive and should be inside JSON for POST request, for example:

{
    "url": "https://example.com/file1.pdf"
}

Attribute

Description

Required

url

URL to the source file. 1

yes

httpusername

HTTP auth user name if required to access source url.

no

httppassword

HTTP auth password if required to access source url.

no

worksheetIndex

The index of the worksheet to use.

no

inline

Set to true to return results inside the response. Otherwise, the endpoint will return a link to the output file generated.

no

async

Set async to true for long processes to run in the background, API will then return a jobId which you can use with the Background Job Check endpoint to check the status of the process and retrieve the output while you can proceed with other tasks.

no

name

File name for the generated output, the input must be in string format.

no

expiration

Set the expiration time for the output link in minutes (default is 60 i.e 60 minutes or 1 hour), After this specified duration, any generated output file(s) will be automatically deleted from PDF.co Temporary Files Storage. The maximum duration for link expiration varies based on your current subscription plan. To store permanent input files (e.g. re-usable images, pdf templates, documents) consider using PDF.co Built-In Files Storage.

no

profiles

Use this parameter to set additional configurations for fine-tuning and extra options. Explore the Profiles section for more.

no

Query parameters#

No query parameters accepted.

Payload#

{
    "url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/other/Input.xls",
    "async": false,
    "name": "Output"
}

Response 2#

{
    "url": "https://pdf-temp-files.s3.amazonaws.com/bd58508fdbaf41cb81309e2195276305/Input.csv",
    "error": false,
    "status": 200,
    "name": "Output.csv",
    "remainingCredits": 59856
}

CURL#

curl --location --request POST 'https://api.pdf.co/v1/xls/convert/to/csv' \
--header 'x-api-key: ' \
--header 'Content-Type: application/json' \
--data-raw '{
    "url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/other/Input.xls",
    "async": false
}'


Code samples#

Footnotes

1

Supports links from Google Drive, Dropbox, and PDF.co Built-In Files Storage. To upload files via the API check out the File Upload section. Note: If you experience intermittent Too Many Requests or Access Denied errors, please try to add cache: to enable built-in URL caching. (e.g cache:https://example.com/file1.pdf) For data security, you have the option to encrypt output files and decrypt input files. Learn more about user-controlled data encryption.

2

Main response codes as follows:

Code

Description

200

Success

400

Bad request. Typically happens because of bad input parameters, or because the input URLs can’t be reached, possibly due to access restrictions like needing a login or password.

401

Unauthorized

402

Not enough credits

445

Timeout error. To process large documents or files please use asynchronous mode (set the async parameter to true) and then check status using the /job/check endpoint. If a file contains many pages then specify a page range using the pages parameter. The number of pages of the document can be obtained using the /pdf/info endpoint.