Research notes

Spreadsheet cells to a Markdown table, and back to text

We put a table of awkward spreadsheet cells through our CSV to Markdown table and Markdown to text tools, and fixed the two things it broke.

Updated 24 September 2026

Type red | green into a cell of a hand-written Markdown table and the row loses its last cell. We tried it: “green” moved into the Price column and the price, 12, vanished from the table. A line break typed inside a cell is worse, since it ends the row there and the rest of the cell becomes a new row of its own. Spreadsheet cells carry both, and both need changing on the way into Markdown.

A table built to break things

On 24 September 2026 we made a nine-row table whose Notes column held a pipe, a line break, quotation marks, a comma, a tab, spaces at both ends and an empty cell. We saved it as CSV and as tab-separated text with Python’s csv module, using its Excel settings, which the Python documentation says match an Excel-generated file. In that format a cell holding a separator, a quotation mark or a line break is wrapped in quotes. Each file went through our CSV to Markdown table tool in Chromium 153, then was shown as HTML with the same GitHub rules our other Markdown tools use, and turned back into plain text with Markdown to text.

Awkward cells through WipeTheAI CSV to Markdown table and Markdown to text, Chromium 153, 24 September 2026. CSV and tab-separated versions gave the same result (n=9 rows)
In the cellIn the MarkdownShown as a tableAs plain text
red | greenred \| greenOne cell, pipe shownOne cell
A line breakfirst line<br>second lineOne cell on two linesOne cell, the break becomes a space (fixed)
the "best" oneAs it wasAs it wasAs it was
one, twoAs it wasAs it wasAs it was
A tabA tabA spaceA space
Spaces at both endsTrimmedTrimmedTrimmed
EmptyAn empty cellAn empty cellTwo tabs in a row

Every row came out with its three cells. A pipe is written as \|, which the GitHub Markdown rules show as a plain pipe, and a line break as <br>, which GitHub and most Markdown viewers show as a new line. Quotation marks come through as they are once the CSV quoting around them is undone.

Two bugs on the way back out

Markdown to text turns a table into one line per row with tabs between cells, so it pastes back into a spreadsheet. Our test caught it breaking that promise: the <br> in the line-break cell became a real line break, so nine rows came out as ten lines and would have pasted as ten rows. The cell now keeps its two lines as one, joined by a space.

The second was a file split by semicolons, the layout used where the comma is the decimal mark. Our tool guesses the separator from the first line, and a header of Produkt;Preis, EUR has one of each. The comma won, so the prices were cut at their decimal commas and “Papier;4” sat in the first column. A tie now goes to the semicolon. Both fixes have tests in our test suite.

One thing already worked: some spreadsheet exports start with an invisible byte order mark, and opening such a file in the tool left no stray character in the first header cell.

What Markdown to text keeps from a real README

We also ran the README of the bat command-line tool through Markdown to text, the same file we printed in our Markdown to PDF test. It went from 33,910 characters to 27,768 in 24 milliseconds.

  • The 83 links kept their words and lost their addresses.
  • The 8 pictures left their descriptions, such as “Git integration example”.
  • Its 2 tables, 14 rows in all, became 14 tab-separated lines.
  • The 58 code blocks stayed as they were. All 78 asterisks, hashes, underscores and backticks left in the text are code: 54 in those blocks and 24 in bits of code inside sentences, such as #!/bin/sh.

If you need the addresses, convert to HTML with Markdown to HTML instead; plain text has nowhere to put a link.

For a table you will print, our Markdown to PDF tool repeats its header row on every page; for one going the other way, from a web page into Markdown, see what survives a web page.

Sources

  1. GitHub Flavored Markdown spec: tables
  2. Python documentation: csv module (excel and excel_tab dialects)
  3. RFC 4180: Common Format and MIME Type for CSV Files
  4. sharkdp/bat on GitHub (the README we turned into text)