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

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
1import cohere
2
3co = cohere.ClientV2(api_key="<YOUR API KEY>")
4
5response = co.chat(
6 model="command-r-plus-08-2024",
7 messages=[
8 {
9 "role": "user",
10 "content": """
11 You are an expert in data formatting. For the following csv data, output it as a markdown table.
12 Output the table only.
13
14 ```
15 name,age,occupation
16 Jane Smith,25,Data Scientist
17 Bob Johnson,42,Software Developer
18 Emily Davis,37,Product Manager
19 ```
20 """,
21 }
22 ],
23)
24
25print(response.message.content[0].text)
Built with