Skip to main content
Cohere

Search documentation

Type to search this documentation.

Create a markdown table from raw data

This is useful if you want to quickly format a great deal of raw data into a more useful markdown table.

Prompt

Text
You are an expert in data formatting. For the following csv data, output it as a markdown table.
Output the table only. 

```
name,age,occupation
Jane Smith,25,Data Scientist
Bob Johnson,42,Software Developer
Emily Davis,37,Product Manager
```

Output

| Name | Age | Occupation |
| --- | --- | --- |
| Jane Smith | 25 | Data Scientist |
| Bob Johnson | 42 | Software Developer |
| Emily Davis | 37 | Product Manager |

API Request

PYTHON
import cohere

co = cohere.ClientV2(api_key="<YOUR API KEY>")

response = co.chat(
    model="command-a-plus-05-2026",
    messages=[
        {
            "role": "user",
            "content": """
    You are an expert in data formatting. For the following csv data, output it as a markdown table.
    Output the table only. 

    ```
    name,age,occupation
    Jane Smith,25,Data Scientist
    Bob Johnson,42,Software Developer
    Emily Davis,37,Product Manager
    ```
    """,
        }
    ],
)

print(response.message.content[0].text)
Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu