> For the complete documentation index, see [llms.txt](https://docs.ziomark.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ziomark.xyz/post-endpoints/excel-to-csv.md).

# Excel to CSV

### /excel-csv

This endpoint accepts a POST request with a multipart form-data body containing an Excel file. It converts the Excel file to CSV format and sends it as a downloadable file in the response. If the file is not provided, it returns a 400 error with a corresponding message. If there is an error during the conversion process, it returns a 500 error with a corresponding message.

**Headers**:

* `Content-Type`: `application/x-www-form-urlencoded`

### Request Parameters

* **File:** The Excel file to be uploaded for conversion. The file should be sent as form-data with the key `file`.

### Response

* **Success Response:**
  * **Status Code:** 200 OK
  * **Content:** The converted CSV file will be downloaded as a response.
  * **Content-Type:** `text/csv`
* **Error Response:**
  * **Status Code:** 400 Bad Request
  * **Content:** `{ "error": "No file uploaded" }` - Indicates that no file was uploaded.
  * **Status Code:** 500 Internal Server Error
  * **Content:** `{ "error": "Failed to convert to CSV" }` - Indicates an error occurred during the conversion process.

### Example Usage

**Request**

```http
POST /excel-csv
Content-Type: multipart/form-data
```

**Request Body**

```
file: <Excel file>
```

### **Response**

```http
HTTP/1.1 200 OK
Content-Disposition: attachment; filename="converted_<timestamp>.csv"
Content-Type: text/csv
```

The CSV file content will be included in the response body.

#### Notes

* The uploaded Excel file will be deleted from the server after conversion.
* The converted CSV file will be deleted from the server after download.
* Ensure that the Excel file is in the correct format (.xlsx) for successful conversion.
