# 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ziomark.xyz/post-endpoints/excel-to-csv.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
