Skip to content
🛠️ToolsShed

Text to Table

Convert delimiter-separated text into HTML, Markdown, or CSV table format.

About this tool

Text to Table is a simple utility that converts delimiter-separated text—such as comma-separated values (CSV), tab-separated, or pipe-delimited data—into formatted tables. Whether you're working with data exported from a spreadsheet, API response, or raw text file, this tool lets you instantly visualize and restructure it as HTML, Markdown, or CSV tables without needing complex software or programming knowledge.

Using the tool is straightforward: paste your delimited text into the input area, specify the delimiter character (comma, tab, semicolon, pipe, or space), and choose your output format. The tool automatically parses each line into rows and columns, then generates a clean, properly formatted table. Common use cases include converting data for web pages, documentation, presentations, or sharing formatted data across different platforms.

The tool works entirely in your browser—no server uploads or external dependencies—making it fast and private. It handles irregular spacing gracefully and works with small datasets to large blocks of text, though very large files may require splitting. This makes it an ideal companion for data analysts, content creators, and anyone who frequently needs to reorganize text-based information into structured tabular form.

Frequently Asked Questions

Code Implementation

import csv
import io

def csv_to_markdown(csv_text: str) -> str:
    reader = csv.reader(io.StringIO(csv_text.strip()))
    rows = list(reader)
    if not rows:
        return ""

    # Determine column widths
    col_count = max(len(row) for row in rows)
    widths = [0] * col_count
    for row in rows:
        for i, cell in enumerate(row):
            widths[i] = max(widths[i], len(cell))

    def fmt_row(row):
        padded = [cell.ljust(widths[i]) for i, cell in enumerate(row)]
        # Pad missing columns
        while len(padded) < col_count:
            padded.append(" " * widths[len(padded)])
        return "| " + " | ".join(padded) + " |"

    lines = []
    lines.append(fmt_row(rows[0]))
    separator = "| " + " | ".join("-" * w for w in widths) + " |"
    lines.append(separator)
    for row in rows[1:]:
        lines.append(fmt_row(row))

    return "\n".join(lines)

csv_data = """Name,Age,City
Alice,30,New York
Bob,25,London"""

print(csv_to_markdown(csv_data))

Comments & Feedback

Comments are powered by Giscus. Sign in with GitHub to leave a comment.