Convert CSV to LaTeX Table Online
Turn CSV rows into a LaTeX tabular you can paste into a paper or report, with special characters escaped for you. The CSV is read in your browser and never uploaded.
Drop a CSV or Excel file here
CSV · XLSX · XLS · XLSM · XLSB
Ready to download as a binary file.
How to convert CSV to LaTeX
Three steps from results.csv to LaTeX.
1. Paste or drop the CSV
Paste CSV text or drop a .csv, .tsv or .txt file; the delimiter is detected.
2. Check it in the grid
Shorten long text cells and headers. Columns with l, c or r don't wrap, so one long cell can make the table wider than the page.
3. Choose environment and rules
tabular or longtable, booktabs rules or grid lines, alignment and escaping; copy the code or download data.tex.
Example: CSV in, LaTeX out
Model evaluation results exported from a Python script, with an underscore in one header.
model,accuracy,f1,params_m
baseline,0.871,0.842,11
ours (large),0.914,0.903,86\begin{tabular}{|l|l|l|l|}
\hline
model & accuracy & f1 & params\_m \\
\hline
baseline & 0.871 & 0.842 & 11 \\
ours (large) & 0.914 & 0.903 & 86 \\
\hline
\end{tabular}Numbers are copied as written: 0.871 stays 0.871, and the header params_m is written as params\_m. For decimal alignment, switch the column to siunitx's S type by hand.
What changes between CSV and LaTeX
Environment
You get a tabular with the column spec {|l|l|l|l|} and \hline rules, one line per row ending in \\. Choose longtable for tables that run over several pages (needs \usepackage{longtable}). There is no table float, so add \begin{table} and \caption yourself.
Escaping
& % $ # _ { } ~ ^ are escaped, so the value params_m is written as params\_m. Untick Escape special chars only when the cells already contain LaTeX, such as math in $...$.
CSV values are plain text
CSV has no types, so the grid gets every value exactly as written, and the LaTeX keeps them that way.
When to convert CSV to LaTeX
- Putting results exported as CSV from Python, R or a lab instrument into a paper.
- Building a table for a thesis or a Beamer slide without typing & and \\ by hand.
CSV to LaTeX in JavaScript
TabularJS reads the CSV into a 2D array. Then special characters are escaped and cells joined with &.
import tabularjs from 'tabularjs';
// CSV values are strings; the header row stays in data[0]
const { worksheets } = await tabularjs('results.csv');
const [header, ...rows] = worksheets[0].data;
const map = { '\\': '\\textbackslash{}', '~': '\\textasciitilde{}', '^': '\\textasciicircum{}' };
const esc = (v) => String(v ?? '').replace(/[\\&%$#_{}~^]/g, (c) => map[c] ?? '\\' + c);
const line = (cells) => cells.map(esc).join(' & ') + ' \\\\';
console.log([`\\begin{tabular}{|${header.map(() => 'l').join('|')}|}`, '\\hline', line(header), '\\hline',
...rows.map((row) => line(header.map((_, i) => row[i]))), '\\hline', '\\end{tabular}'].join('\n'));TabularJS returns CSV values as strings and leaves the header in data[0]. It does not guess the delimiter: comma is the default, so pass { delimiter: ';' } for semicolon files.
Frequently asked questions
Can I use the output on Overleaf?
Yes. Paste it into your .tex file. Plain tabular needs no package; add \usepackage{booktabs} or \usepackage{longtable} to the preamble if you use those options.
How do I make the header row bold?
Wrap the header cells in \textbf{} after copying. If you type \textbf{...} into the grid instead, untick Escape special chars and escape characters such as _ yourself.
What if my CSV has no header row?
Untick "First row as header". The first line is then treated as data and the columns are named col_1, col_2, col_3 in the LaTeX.
Which LaTeX packages do I need?
None for the default tabular. Add \usepackage{booktabs} if you tick booktabs and \usepackage{longtable} if you choose longtable.
Does results.csv get uploaded when I convert it to LaTeX?
No. The CSV is read in your browser and never uploaded.