Format Code Now
/
ConvertLaTeX Table Generator Next: CSV to XML and JSON ›

LaTeX Table Generator

CV-97

Paste rows from a spreadsheet or a CSV file and get a LaTeX tabular, with the special characters escaped, optional header, alignment and lines.

Runs in your browser. Nothing is uploaded.

Table data: one row per line, comma, tab, semicolon or pipe separated

LaTeX

How to use it

  1. Copy cells from a spreadsheet, or paste CSV text, into the input box.
  2. Choose the alignment and line style, and whether the first row is a bold header.
  3. Choose tabular only, or a table with a caption and label.
  4. Click Generate LaTeX and paste the result into your document.

Escaping and input

Pasted spreadsheet cells are tab separated, and the tool detects tabs, commas, semicolons and pipes from the first line, or you can set the separator. Quoted CSV fields may contain separators and line breaks. Every cell is escaped so that & % $ # _ { } ~ ^ and backslash print as typed instead of breaking the document. Rows that are shorter than the longest row are padded with empty cells so the column count is consistent.

Lines, booktabs and limits

Horizontal rules use the booktabs commands \toprule, \midrule and \bottomrule when ticked, which needs \usepackage{booktabs} in your preamble; with it unticked, plain \hline is used. The grid option adds vertical lines as well. All columns share one alignment, and merged cells and fixed column widths are not generated, so edit those by hand. The table is not compiled here. Wide tables may need a smaller font or a tabularx or longtable setup in your own document.

Error messages and what to do

MessageWhat it meansFix
Paste the table data: one row per line, values separated by commas, tabs, semicolons or pipes.The input is empty.Paste at least one row of data.
A quoted field is never closed (missing closing ")A field starts with a quote that is never closed.Add the closing quote, or remove the stray one.

Questions people ask

How do I convert Excel data to a LaTeX table?

Select the cells in Excel, copy them and paste here. Tab separated data is detected automatically. Click Generate LaTeX and paste the tabular into your document.

How do I escape special characters in LaTeX?

Put a backslash before & % $ # _ { }. For backslash, ~ and ^ use \textbackslash{}, \textasciitilde{} and \textasciicircum{}. The generator does this for every cell.

What is booktabs and do I need it?

Booktabs is a LaTeX package that gives tables cleaner horizontal rules with proper spacing. It needs \usepackage{booktabs}. Untick it to use \hline, which needs no package.

How do I align numbers to the right?

Set Column alignment to Right. All columns use the same alignment, so for mixed alignment edit the column format, for example {l r r}, in the generated code.

Can I add a caption and label?

Yes. Choose table with caption to wrap the tabular in a table environment with a placeholder \caption and \label to edit. Change the caption text and the label name to suit your document.

Does it handle CSV with quoted commas?

Yes. A quoted field such as "Paris, France" stays in one cell, and a line break inside quotes becomes a space. Doubled quotes inside a quoted field become one quote character.

About this tool

The first line decides the separator when it is set to Detect (comma, tab, semicolon or pipe, whichever appears most). Quoted CSV fields can hold separators and line breaks; a line break inside a cell becomes a space. Every cell is escaped for LaTeX: & % $ # _ { } ~ ^ and backslash are written so they print as typed. Shorter rows are padded with empty cells. All columns get the same alignment; per column alignment, merged cells and column widths are not generated. Horizontal rules use booktabs (\toprule, \midrule, \bottomrule) when ticked, which needs \usepackage{booktabs} in your document; otherwise \hline is used. The table is not compiled here, so check wide tables in your own LaTeX.

Format Code Now: free, no ads, no accounts. Your input stays in your browser.