Skip to content

Excel to HTML API Documentation

Overview

The Excel to HTML API converts Excel files (.xls, .xlsx) into clean, styled HTML tables.
It supports multiple sheets, optional headers, and sheet selection by name or index.
The API can operate in three modes:

  • Body Mode (Synchronous): Upload Excel file directly in the request body.
  • URL Mode (Asynchronous): Provide a remote file URL for conversion.
  • File Mode (Asynchronous): Provide a previously uploaded file path for conversion.

Endpoint (POST)

POST https://api.apidatatools.com/excel-to-html-api

Headers

Header Description Example
Content-Type Must be application/octet-stream for binary Excel uploads application/octet-stream
x-source-type Defines input mode: body, url, or file body
x-has-header Indicates if Excel has headers (1/true/yes or 0/false/no) true
x-sheet-name Optional sheet name to convert Sheet1
x-sheet-index Optional sheet index (0-based) to convert 0
x-api-key Your API key for authentication abcd1234xyz

Accepted File Extensions

  • .xls
  • .xlsx

Input Example (Body Mode)

Binary Excel file uploaded directly in request body.

Headers:

Content-Type: application/octet-stream
x-source-type: body
x-has-header: true
x-api-key: YOUR_API_KEY

Body:
Binary content of Excel file.


Input Example (URL Mode)

Provide a remote file URL for asynchronous processing.

Headers:

Content-Type: application/json
x-source-type: url
x-api-key: YOUR_API_KEY

Body:

{
  "url": "https://example.com/sample.xlsx"
}


Input Example (File Mode)

Provide a previously uploaded file path for asynchronous processing.

Headers:

Content-Type: application/json
x-source-type: file
x-api-key: YOUR_API_KEY

Body:

{
  "file": "user123/uploads/sample.xlsx"
}


Example Request

Synchronous (Body Input)

POST https://api.apidatatools.com/excel-to-html-api
Content-Type: application/octet-stream
x-source-type: body
x-has-header: true
x-api-key: YOUR_API_KEY

Body: Binary Excel file content.


Asynchronous (Remote File URL)

POST https://api.apidatatools.com/excel-to-html-api
Content-Type: application/json
x-source-type: url
x-api-key: YOUR_API_KEY

Body:

{
  "url": "https://example.com/data.xlsx"
}


Asynchronous (Input File)

POST https://api.apidatatools.com/excel-to-html-api
Content-Type: application/json
x-source-type: file
x-api-key: YOUR_API_KEY

Body:

{
  "file": "user123/uploads/data.xlsx"
}


Example Response

Successful (Body Mode)

{
  "status": "success",
  "request_id": "b1a2c3d4e5",
  "file": "https://downloads.apidatatools.com/apidatatools_convert_abc123.html",
  "preview": "<!DOCTYPE html><html lang=\"en\"><head>..."
}

Async Job Accepted

{
  "status": "accepted",
  "job_id": "job-12345-xyz",
  "status_url": "https://api.apidatatools.com/jobs/job-12345-xyz",
  "request_id": "b1a2c3d4e5"
}

Error Handling

Error Code HTTP Status Description Example
INVALID_EXCEL_CONTENT_TYPE 400 Input is not valid Excel bytes {"status":"error","error":"INVALID_EXCEL_CONTENT_TYPE","details":{"message":"Excel content must be raw bytes."}}
EXCEL_READ_FAILED 400 Failed to read Excel file {"status":"error","error":"EXCEL_READ_FAILED","details":{"message":"Failed to read Excel file."}}
EXCEL_TO_HTML_CONVERSION_FAILED 400 Conversion to HTML failed {"status":"error","error":"EXCEL_TO_HTML_CONVERSION_FAILED","details":{"message":"Failed to convert sheet"}}
INVALID_BODY_ENCODING 400 Body could not be decoded {"status":"error","error":"INVALID_BODY_ENCODING","details":{"message":"Failed to base64-decode binary body."}}
EMPTY_BODY 400 No body provided {"status":"error","error":"EMPTY_BODY","details":{"message":"Request body is empty."}}
PAYLOAD_TOO_LARGE 413 Body exceeds plan limit {"status":"error","error":"PAYLOAD_TOO_LARGE","details":{"message":"Request body exceeds limit."}}
INVALID_URL 400 Invalid or missing URL {"status":"error","error":"INVALID_URL","details":{"message":"URL must be valid http/https."}}
URL_UNREACHABLE 400 URL cannot be reached {"status":"error","error":"URL_UNREACHABLE","details":{"message":"Could not reach URL."}}
URL_NOT_OK 400 URL returned non-200 status {"status":"error","error":"URL_NOT_OK","details":{"message":"URL returned HTTP 404."}}
FILE_TOO_LARGE 413 File exceeds plan limit {"status":"error","error":"FILE_TOO_LARGE","details":{"message":"File exceeds plan limit."}}
INVALID_FILE_EXTENSION 400 Unsupported file extension {"status":"error","error":"INVALID_FILE_EXTENSION","details":{"message":"Invalid or unsupported file extension."}}
FILE_UNAVAILABLE 400 File not found or inaccessible {"status":"error","error":"FILE_UNAVAILABLE","details":{"message":"Could not access file."}}
INTERNAL_ERROR 500 Unexpected server error {"status":"error","error":"INTERNAL_ERROR","details":{"message":"Failed to process your request"}}

Async Job Status

To check the status of an asynchronous job, use the status_url provided in the accepted response.

Endpoint

GET https://api.apidatatools.com/jobs/{job_id}

Example Status Response for Async

Queued

{
  "job_id": "job-12345-xyz",
  "status": "queued",
  "message": "Your job is being processed.",
  "retry_after": 2
}

Success

{
  "job_id": "job-12345-xyz",
  "status": "success",
  "created_at": 1712345678,
  "updated_at": 1712345689,
  "result": {
    "request_id": "b1a2c3d4e5",
    "status": "success",
    "file": "https://downloads.apidatatools.com/apidatatools_convert_abc123.html",
    "preview": "<!DOCTYPE html><html lang=\"en\"><head>..."
  }
}

Failed

{
  "job_id": "job-12345-xyz",
  "status": "failed",
  "error": {
    "code": "EXCEL_READ_FAILED",
    "message": "Failed to read Excel file.",
    "details": {"message": "Invalid Excel format"}
  }
}

Notes for Developers

  • The API supports body, url, and file modes.
  • For asynchronous operations, a job_id and status_url are returned immediately.
  • Use the Status API to poll job progress until completion.
  • The request_id is included in every response for traceability.
  • The output HTML file is uploaded to a secure storage and accessible via the returned file URL.
  • The preview field contains the first 100KB of the generated HTML for quick inspection.