Guide
Spreadsheet data as a MediaWiki table
Tables on Wikipedia and other MediaWiki sites are written in wikitext, a compact syntax of braces, pipes and exclamation marks. It is quick once learned, but typing a large table by hand is slow and one stray pipe can shift every column after it. This converter takes data from a spreadsheet or CSV file and writes the markup for you.
How wikitable markup works
A table starts with {| and ends with |}. The class wikitable gives the standard grey-bordered look. |+ adds a caption, |- starts a new row, ! starts a header cell and | a data cell. Cells on the same line are separated by !! or ||. An attribute such as an alignment goes before a single pipe at the start of a cell: style="text-align:right" | 42.
Sortable tables
Keep “Sortable columns” on and the table gets the sortable class; readers can then click any header to sort. MediaWiki recognises numbers with thousands separators, dates and percentages, so a population column sorts numerically, not alphabetically.
Accessibility: captions and row headers
Wikipedia’s accessibility guidance asks data tables to have a caption describing them and, where each row is about one thing, a row header. Type a caption, and turn on “First column as row headers” for tables like a list of countries: the first cell of each row becomes a header with scope="row", so screen readers announce it when moving along the row.
Numbers and alignment
Columns holding only numbers are right-aligned when that option is on, which makes digits line up. The alignment is written per cell, so it survives sorting and copying.
Escaping and line breaks
Because pipes separate cells, a value containing one — a song title, a command, a ratio written a|b — would break the table. Each pipe inside a value is written as {{!}}, a magic word every MediaWiki site provides for a literal pipe. Line breaks inside a spreadsheet cell become <br />.
Compact or one cell per line
The compact style puts each row on one line, which is easy to scan when cells are short. One cell per line is easier to edit and to compare in the page history when cells hold long text or references. Both render the same.
A worked example
The sample lists the four most populous countries. Its header becomes ! Rank !! Country !! Population (2024) !! Capital, and the first data row reads | style="text-align:right" | 1 || India || style="text-align:right" | 1,450,935,791 || New Delhi.
Editing etiquette on Wikipedia
Cite the source of the data in the caption or in a reference after it, and preview before saving. Very wide tables are hard to read on phones, so consider splitting one with many columns.
Preparing the spreadsheet
Tidy the data before converting: one header row, no blank rows or columns, no merged cells, and consistent units in each column. Format numbers the way they should appear in the article, with thousands separators if the article uses them, because the values are copied exactly as they are in the cells.
Related tools
Cite the data source with the Wikipedia Citation Generator, make LaTeX tables with CSV to LaTeX, HTML tables with CSV to HTML Table, or convert pasted terminal tables with the ASCII Table Converter.
Checked against the current version of the CSV to MediaWiki Table Converter on .

