DEV Community

WTSolutions
WTSolutions

Posted on

Excel to JSON by WTSolutions API Documentation

Introduction

The Excel to JSON API provides a simple way to convert Excel and CSV data into JSON format. This API accepts tab-separated or comma-separated text data and returns structured JSON.

Endpoint

POST https://mcp.wtsolutions.cn/excel-to-json-api

Request Format

The API accepts POST requests with a JSON body containing the following parameter:

Parameter Type Required Description
data string Yes Tab-separated or comma-separated text data with at least two rows (header row + data row)

Example Request

{ "data": "Name\tAge\tIsStudent\nJohn Doe\t25\tfalse\nJane Smith\t30\ttrue" } 
Enter fullscreen mode Exit fullscreen mode

Response Format

The API returns a JSON object with the following structure:

Field Type Description
isError boolean Indicates if there was an error processing the request
msg string Status message or error description
data array/object/null Converted JSON data (null if there was an error)

Example Success Response

{ "isError": false, "msg": "success", "data": [ { "Name": "John Doe", "Age": 25, "IsStudent": false }, { "Name": "Jane Smith", "Age": 30, "IsStudent": true } ] } 
Enter fullscreen mode Exit fullscreen mode

Example Error Response

{ "isError": true, "msg": "At least 2 rows are required in Excel Data", "data": null } 
Enter fullscreen mode Exit fullscreen mode

Data Type Handling

The API automatically detects and converts different data types:

  • Numbers: Converted to numeric values
  • Booleans: Recognizes 'true'/'false' (case-insensitive) and converts to boolean values
  • Dates: Detects various date formats and converts them appropriately
  • Strings: Treated as string values
  • Empty values: Represented as empty strings

Error Handling

The API returns descriptive error messages for common issues:

  • Excel Data Format Invalid: When input data is not tab-separated or comma-separated
  • At least 2 rows are required: When input data has fewer than 2 rows
  • Blank/Null/Empty cells in the first row not allowed: When header row contains empty cells
  • Server Internal Error: When an unexpected error occurs

Pricing

Free for now.

Donation

https://buymeacoffee.com/wtsolutions

Top comments (0)