ASCII Table to TSV Converter
Convert ASCII-formatted tables (MySQL, Markdown, PostgreSQL) to clean TSV tab-separated values instantly. Paste, convert, download.
About
Command-line tools, database clients, and documentation systems routinely output tabular data as ASCII art - bordered with pipes (|), dashes (−), and plus signs (+). Importing that data into spreadsheets, databases, or ETL pipelines requires stripping the decorative characters and converting to a machine-readable delimiter format. Manual cleanup with find-and-replace is error-prone: misaligned columns, phantom whitespace, and dropped rows corrupt datasets silently. This tool parses the structural geometry of the ASCII table - detecting column boundaries from pipe positions, classifying separator rows via pattern matching against /^[+\-=|:\s]+$/, and extracting trimmed cell values into clean TSV output.
Supported input formats include MySQL CLI output, PostgreSQL psql formatting, Markdown pipe tables, and reStructuredText grid tables. The parser handles irregular spacing, mixed separator styles, and tables with or without explicit header separators. Limitation: space-aligned tables without any pipe delimiters require at least two consistent whitespace gaps between columns for reliable detection. Pro tip: if your source table uses Unicode box-drawing characters (─, │, ┌), replace them with ASCII equivalents before pasting.
Formulas
The parser operates in three stages. First, line classification assigns each input line a type:
Second, column boundary detection identifies the character indices of all pipe delimiters across data rows:
The intersection of boundary sets across all data rows yields stable column positions. Third, cell extraction uses boundaries to slice each data line:
Where Bj is the j-th boundary index. Output encoding joins cells with a horizontal tab character (U+0009) and rows with a newline (U+000A). Cells containing literal tabs are escaped to preserve TSV structural integrity.
Reference Data
| Format | Separator Row Pattern | Column Delimiter | Header Indicator | Example Source |
|---|---|---|---|---|
| MySQL CLI | +−−−+−−−+ | | | First separator after header row | mysql −e "SELECT..." |
| PostgreSQL psql | −−−−+−−−− | | | Separator below header | psql −c "SELECT..." |
| Markdown Pipe | | −−− | −−− | | | | Second row is always separator | GitHub, GitLab, Reddit |
| reStructuredText Grid | +===+===+ | | | = line vs − line | Sphinx documentation |
| reStructuredText Simple | === === | Whitespace (≥2 spaces) | Double = lines | Sphinx documentation |
| Org-mode | |−−−+−−−| | | | Separator row with − | Emacs Org tables |
| JIRA/Confluence | None (double ||) | || for header, | for data | Double-pipe cells | Atlassian products |
| ASCII Box Drawing | ┌───┬───┐ | │ | Top/bottom borders | Various CLI tools |
| Space-aligned | None | ≥2 consecutive spaces | First row assumed header | df −h, ps aux |
| TSV (passthrough) | None | Tab character (\t) | First row | Already converted |
| CSV (common confusion) | None | Comma (,) | First row | Not supported - use CSV tool |
| Tab Width Standard | N/A | U+0009 (1 char) | N/A | TSV specification (IANA) |
| TSV MIME Type | N/A | N/A | N/A | text/tab-separated-values |
| Max Safe Columns | N/A | N/A | N/A | Excel: 16384, Sheets: 18278 |
| Max Safe Rows | N/A | N/A | N/A | Excel: 1048576 |