Excel to HTML API¶
Overview¶
Convert an Excel workbook to HTML. Submit the workbook directly for synchronous processing, or provide a URL or pre-uploaded file reference to process asynchronously.
Endpoint¶
Method: POST
URL: https://api.apidatatools.com/excel-to-html-api
Authentication¶
Include your API key in the x-api-key header:
x-api-key: YOUR_API_KEY
Input modes¶
| Mode | Processing | Input |
|---|---|---|
body | Synchronous | Raw Excel workbook bytes |
url | Asynchronous | JSON object containing a URL |
file | Asynchronous | JSON object containing a pre-uploaded file’s storage key |
If x-source-type is omitted, the request uses body mode.
Headers¶
| Header | Type | Required | Default / values | Description |
|---|---|---|---|---|
x-api-key | String | Yes | Your API key | Authenticates the request. |
x-source-type | String | No | Default: body; values: body, url, file | Selects how the input is provided. Header names are case-insensitive. |
Accepted file extensions¶
URL and file modes accept Excel files with these extensions:
.xls.xlsx
Request body¶
Body mode¶
Send the workbook as the raw request body. Use curl --data-binary to preserve the file bytes.
URL mode¶
Send a JSON object with a publicly reachable http or https URL:
{"url":"https://example.com/input.xlsx"}
File mode¶
Send a JSON object with the exact storage key associated with a file uploaded through the upload workflow. Do not add a prefix to the key.
{"file":"S3_KEY_RETURNED_BY_THE_UPLOAD_WORKFLOW"}
curl examples¶
Body mode¶
curl --request POST \
'https://api.apidatatools.com/excel-to-html-api' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'x-source-type: body' \
--data-binary '@input.xlsx'
URL mode¶
curl --request POST \
'https://api.apidatatools.com/excel-to-html-api' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'x-source-type: url' \
--data '{"url":"https://example.com/input.xlsx"}'
File mode¶
curl --request POST \
'https://api.apidatatools.com/excel-to-html-api' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'x-source-type: file' \
--data '{"file":"S3_KEY_RETURNED_BY_THE_UPLOAD_WORKFLOW"}'
Success responses¶
Synchronous body mode¶
A successful body-mode request returns HTTP 200 with a file URL and a preview:
{
"request_id": "REQUEST_ID",
"status": "success",
"file": "https://downloads.apidatatools.com/OUTPUT_FILE",
"preview": "..."
}
The download URL is temporary. Retention depends on your plan.
Asynchronous URL and file modes¶
A successfully accepted asynchronous request returns HTTP 202:
{
"status": "accepted",
"job_id": "JOB_ID",
"status_url": "https://api.apidatatools.com/jobs/JOB_ID",
"request_id": "REQUEST_ID"
}
Async job status¶
Poll the returned status_url with an authenticated GET request:
curl --request GET \
'https://api.apidatatools.com/jobs/JOB_ID' \
--header 'x-api-key: YOUR_API_KEY'
The status response includes request_id, job_id, status, created_at, and updated_at. The remaining fields depend on the job status.
Queued or processing¶
For statuses other than success and failed, the response includes a message and retry interval:
{
"request_id": "REQUEST_ID",
"job_id": "JOB_ID",
"status": "queued",
"created_at": 1700000000,
"updated_at": 1700000000,
"message": "Your job is being processed.",
"retry_after": 2
}
The status value is the current job status, such as queued or processing.
Success¶
A completed job includes its result:
{
"request_id": "REQUEST_ID",
"job_id": "JOB_ID",
"status": "success",
"created_at": 1700000000,
"updated_at": 1700000001,
"result": {
"status": "success",
"file": "https://downloads.apidatatools.com/OUTPUT_FILE",
"preview": "..."
}
}
Failed¶
A failed job includes an error code, message, and details:
{
"request_id": "REQUEST_ID",
"job_id": "JOB_ID",
"status": "failed",
"created_at": 1700000000,
"updated_at": 1700000001,
"error": {
"code": "ERROR_CODE",
"message": "Error message",
"details": {}
}
}
Error handling¶
Errors use this envelope. details may contain additional fields:
{
"status": "error",
"error": "ERROR_CODE",
"request_id": "REQUEST_ID",
"details": {
"message": "Error message"
}
}
| HTTP status | Error codes | When it can occur |
|---|---|---|
400 | INVALID_SOURCE_TYPE, INVALID_BODY_ENCODING, EMPTY_BODY | The source type is unsupported, the request body cannot be decoded, or the body is empty. |
400 | INVALID_BODY, INVALID_URL, URL_UNREACHABLE, URL_NOT_OK, INVALID_FILE, FILE_UNAVAILABLE, INVALID_FILE_EXTENSION | An asynchronous request body, URL, or file reference is invalid or unavailable, or the file extension is unsupported. |
400 | INVALID_JOB_ID, JOB_NOT_FOUND, FORBIDDEN, DDB_ERROR | The job-status request has a missing or unknown job ID, access is denied, or the status lookup fails. |
400 | Tool-specific errors | The converter rejects the input. |
401 | UNAUTHORIZED | Authentication fails. |
404 | USER_NOT_FOUND, UNKNOWN_FUNCTION | The authenticated user cannot be found, or the requested endpoint is unsupported. |
413 | PAYLOAD_TOO_LARGE | A synchronous request body exceeds the limit for your plan. |
413 | FILE_TOO_LARGE | A remote or uploaded file exceeds the effective limit for your plan. |
429 | QUOTA_EXCEEDED, RATE_LIMITED | A plan quota or rate limit has been reached. |
500 | PLAN_NOT_FOUND, INTERNAL_ERROR | Plan configuration is unavailable, or request processing fails. |
500 | CONFIG_ERROR, PLAN_CONFIG_ERROR | Async job configuration or plan limits are unavailable or invalid. |
Some errors occur during asynchronous processing rather than when the job is submitted. For example, DOWNLOAD_FAILED and UPLOAD_FAILED are reported as failed job errors in the status response.
Notes¶
- Body-size and file-size limits, quotas, rate limits, and download retention depend on your plan. See tool limits.
- A failed asynchronous job is reported through the job-status response; check its
errorobject for the code, message, and details. - Download URLs are temporary, and their retention period depends on your plan.