How to Convert a Worksheet to HTML Using Aspose.Cells Cloud API
The ConvertWorksheetToHtml endpoint reads an Excel workbook from the local file system, extracts the specified worksheet, and returns the content as an HTML file. The conversion runs entirely on Aspose’s cloud servers, so no intermediate upload or storage is required. Ideal for generating web‑ready views of spreadsheet data, the API supports optional output paths, custom fonts, region settings, and password‑protected workbooks.
Convert worksheet to HTML API
Web API
PUT https://api.aspose.cloud/v4.0/cells/convert/worksheet/html
Security and Authentication
The Aspose.Cells Cloud APIs are secure and require JWT token-based authentication.
-H "Authorization: Bearer {access_token}"
Request Parameters
| Parameter Name | Type | Location | Required/Optional | Description |
|---|---|---|---|---|
| Spreadsheet | File | Required | FormData | Binary Excel file to be processed. Must be a valid .xlsx, .xls, .xlsb, etc. Example: myWorkbook.xlsx. The Excel file is read directly from the request body; no prior upload to cloud storage is needed. |
| worksheet | String | Required | Query | Name of the worksheet to convert (case‑sensitive). Must exist in the supplied workbook. Example: Sheet1. |
| outPath | String | Optional | Query | Target folder path (in cloud storage) where the generated HTML file will be saved. If omitted, the file is returned directly in the response. Example: /output/html/. |
| outStorageName | String | Optional | Query | Name of the cloud storage service to use for outPath. Required only when outPath points to a non‑default storage. |
| fontsLocation | String | Optional | Query | Absolute path to a folder containing custom TrueType/OpenType fonts that should be used during conversion. Enables correct rendering of non‑standard characters. |
| region | String | Optional | Query | Locale identifier that influences number/date formatting (e.g., en-US, fr-FR). Defaults to the workbook’s internal region setting. |
| password | String | Optional | Query | Password required to open a protected workbook. Omit for unprotected files. |
Response
[
{
"Name": "ResponseFile",
"DataType": {
"Identifier": "File",
"Reference": "Stream"
}
}
]
Error Codes
| Code | Meaning | Typical Cause | Resolution |
|---|---|---|---|
| 400 | Bad Request | Invalid API URI or malformed request | Verify the endpoint URL and request syntax. |
| 401 | Unauthorized | Missing or invalid authentication token | Refresh the OAuth 2.0 token and ensure proper scopes. |
| 404 | Not Found | Spreadsheet file cannot be accessed | Confirm the file name and storage location. |
| 500 | Server Error | Unexpected processing error on server | Retry the request; if the problem persists, contact support. |
Where should we use the Convert worksheet to HTML API?
- Embed live spreadsheet data in a web portal – Convert a financial‑report worksheet to HTML for direct viewing in browsers without requiring Excel plugins.
- Generate printable HTML invoices from an Excel template – Automate the creation of web‑ready invoice pages from a predefined worksheet.
- Create documentation snippets – Convert design‑specification sheets to HTML fragments that can be inserted into technical manuals or wikis.
- Develop low‑code BI dashboards – Pull worksheet data, convert it to HTML, and display it within custom dashboard widgets.
Why should you use the Convert worksheet to HTML API?
- Zero‑Upload Workflow – Convert local files directly in the cloud, eliminating the need to transfer large workbooks to storage first.
- High‑Performance Rendering – Server‑side conversion leverages Aspose’s optimized engine, delivering fast and accurate HTML output.
- Full Control Over Output – Optional parameters (custom fonts, region, password) let you tailor the HTML to match locale and branding requirements.
- Seamless Integration – Simple PUT request with multipart/form‑data fits naturally into CI/CD pipelines, micro‑services, or serverless functions.
How to use the Convert worksheet to HTML API with SDKs
Convert worksheet to HTML API Specification
Convert Worksheet to HTML API Specification provides a publicly accessible programming interface for executing REST interactions directly from a web browser.
Excel API SDK
Use Aspose.Cells Cloud SDKs
Using the SDK is the fastest way to develop, as it abstracts away the low‑level details, allowing you to merge a spreadsheet into another spreadsheet with short code.
Please check out the GitHub repository for a complete list of Aspose.Cells Cloud SDKs.
The following code examples demonstrate how to interact with Aspose.Cells web services using various SDKs: