CSV for AI: Giving a Model a Table It Can Read
Convert a CSV file to a Markdown table before you give it to an LLM, using a parser that respects quotes and the real delimiter. CSV stores one row per line, with the values separated by commas. A tidy file converts to a table in a few lines of code. Many real exports put commas, quotes or line breaks inside a value, and a converter that splits on every comma then shifts the columns.
How CSV to Markdown works on a clean file
A clean file like this:
Name,Role,Score
Ada,Engineer,99
Grace,Admiral,100
becomes this:
| Name | Role | Score |
| --- | --- | --- |
| Ada | Engineer | 99 |
| Grace | Admiral | 100 |
For a file like this one, splitting each line on its commas and adding pipes is enough.
Where it goes wrong
Exports from spreadsheets and databases can break that simple split in four ways:
- Commas inside fields.
"Smith, John"is one field. The comma is data, protected by quotes. A converter that splits on every comma turns that row into a misaligned mess. - Quotes inside fields. A field containing a quotation mark escapes it, usually by doubling it (
""). Handle it wrong and the parser loses track of where fields begin and end. - Newlines inside fields. A quoted field can contain a line break, such as an address or a note. So "one line per row" isn't reliable either.
- The delimiter isn't always a comma. TSV uses tabs. Many European exports use semicolons, because the comma is their decimal separator. Assume a comma, and a semicolon file becomes one mangled column.
MarkPrep's CSV to Markdown converter uses a full CSV parser. It detects the delimiter and handles quoted fields, so "Smith, John" stays one field.
Why column alignment matters for an LLM
A Markdown table keeps every value bound to its column header, so the LLM knows that 99 is Ada's score and not her role. In a misaligned conversion, a stray comma shoves every value in the row one column to the left. The LLM then reads wrong relationships. It will answer questions confidently from shifted data, and you may not notice.
Converting CSV in your browser
MarkPrep converts CSV inside the browser tab, so the file never leaves your computer. That suits CSV files that hold customer lists, transactions or user records. Run your file through the CSV to Markdown converter and compare a few rows with the original before you paste the table into an LLM. For workbooks with several sheets, use Excel to Markdown, which writes one table per sheet.
Try it on your own file
Convert a document and watch the token counter. It's free, needs no account and uploads nothing.