Excel to JSON
This REST API converts a spreadsheet file to a JSON‑formatted file.
REST API
| API | Type | Description | Swagger Link |
|---|---|---|---|
| /cells/convert/json | POST | Convert a spreadsheet to a JSON file. | PostConvertWorkbookToJson |
Request
Query Parameters
| Parameter Name | Type | Description |
|---|---|---|
password |
string | Password required to open the Excel file (optional). |
storageName |
string | Name of the storage where the file is located (optional). |
checkExcelRestriction |
bool | Enforces Excel‑specific restrictions when modifying cells (optional). |
Request Body Parameter
| Parameter Name | Type | Description |
|---|---|---|
datafile |
file | The Excel file to be uploaded. Must be sent as the first part of a multipart/form-data request. |
Example cURL Call
curl -X POST "https://api.aspose.cloud/v3.0/cells/convert/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "accept: application/json" \
-H "Content-Type: multipart/form-data" \
-F "File=@myWorkbook.xlsx"
Response
The service returns a FileInfo object. The important fields are described below:
| Field | Type | Description |
|---|---|---|
Filename |
string | Name of the generated JSON file (e.g., myWorkbook.json). |
FileSize |
integer | Size of the generated file in bytes. |
FileContent |
string | Base64‑encoded content of the JSON file. Decode to retrieve the actual JSON. |
Example response
{
"Filename": "myWorkbook.json",
"FileSize": 8423,
"FileContent": "eyJmb3JtYXR0ZWRfZGF0YSI6IH ... (base64 string) ..."
}
Error Handling
If the request fails, the API returns an error object with the following structure:
| Field | Type | Description |
|---|---|---|
Code |
string | Machine‑readable error identifier. |
Message |
string | Human‑readable description of the error. |
Common HTTP status codes:
- 400 – Bad request (e.g., missing file, invalid parameters).
- 401 – Unauthorized (invalid or missing access token).
- 500 – Internal server error.
The OpenAPI Specification defines a publicly accessible programming interface and lets you carry out REST interactions directly from a web browser.
You can use cURL command‑line tool to access Aspose.Cells web services easily. The following example shows how to make calls to the Cloud API with cURL.
Cloud SDK Family
Using an SDK is the best way to speed up development. An SDK handles low‑level details so you can focus on your project tasks. Please check out the GitHub repository for a complete list of Aspose.Cells Cloud SDKs.
The following code examples demonstrate how to make calls to Aspose.Cells web services using various SDKs:
Other APIs that implement similar functionality
- POST /cells/{name}/saveAs – Saves an Excel file as an HTML file with additional settings and stores the result in the specified storage.
- PUT /cells/convert – Converts an Excel file to an HTML file with additional settings and returns the result in the response.
- GET /cells/{name} – Retrieves an Excel file; can be used with query parameters to obtain the file in HTML format.