> For the complete documentation index, see [llms.txt](https://cloudbrowser.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cloudbrowser.gitbook.io/docs/configurations/ai-functions/to-csv.md).

# To CSV

### NodeJS

```javascript
const html = await getHTML("http://www.cloudbrowser.ai");
if (!html) return;

const csv = await ai.toCSV({
  html: html,
  headers: "Name,Price,Duration",
});

console.log("CSV:", csv.response);
```

### .NET

```csharp
var html = await GetHTML("http://www.cloudbrowser.ai").ConfigureAwait(false);

if (html == null) return;

var csv = await ai.ToCSV(new() {
  Html = html,
  Headers = "Name,Price,Duration"
}).ConfigureAwait(false);
```

### **/api/v1/ai/ToCSV – Convert HTML to a CSV File**

**Method**:\
`POST`

**Parameters**:

* `html`: *(string)* – The HTML document to convert.
* `headers`: *(string, optional)* – Custom headers for the CSV file.
* `responseFormat`: *(string)* – The format of the response, typically `csv`.

**Request Example**:

```bash
curl -X POST https://production.cloudbrowser.ai/api/v1/ai/ToCSV \
-H "Content-Type: application/json" \
-d '{
  "html": "<table>...</table>",
  "headers": "Name,Email,Phone",
  "responseFormat": "csv"
}'
```
