csvmd
Convert a CSV file to a Markdown table 📊
# Convert a file on disk
# Convert a file passed to stdin
|
Installation
macOS or Linux via Homebrew
- Install the latest version by running
brew tap timrogers/tap && brew install csvmd. - Run
csvmd --helpto check that everything is working and see the available commands.
macOS, Linux or Windows via Cargo, Rust's package manager
- Install Rust on your machine, if it isn't already installed.
- Install the
csvmdcrate by runningcargo install csvmd. - Run
csvmd --helpto check that everything is working and see the available commands.
macOS, Linux or Windows via direct binary download
- Download the latest release for your platform. macOS, Linux and Windows devices are supported.
- Add the binary to
$PATH, so you can execute it from your shell. For the best experience, call itcsvmdon macOS and Linux, andcsvmd.exeon Windows. - Run
csvmd --helpto check that everything is working and see the available commands.
Usage
Convert CSV to Markdown table
Usage: csvmd [OPTIONS] [FILE]
Arguments:
[FILE] Input CSV file (if not provided, reads from stdin)
Options:
-d, --delimiter <DELIMITER> CSV delimiter character [default: ,]
--no-headers Treat first row as data, not headers
--stream Use streaming mode for large files (writes output immediately)
--align <ALIGN> Header alignment: left, center, or right [default: left]
-h, --help Print help
-V, --version Print version
Basic Examples
# Basic usage with left-aligned headers (default)
# Center-aligned headers for better readability
# Right-aligned headers for numeric data
# Combined with other options
# Streaming mode with alignment for large files
Performance ⚡
csvmd is built for speed and efficiency. Here are some benchmarks showing processing times for various scenarios:
Real-world Data Processing
| Dataset | Rows | Input Size | Processing Time | Memory Usage |
|---|---|---|---|---|
| Employee Records | 1,000 | 71KB | 4ms | 3MB |
| Employee Records | 10,000 | 731KB | 10ms | 8MB |
| Employee Records | 100,000 | 7MB | 150ms | 66MB |
| Employee Records | 200,000 | 13MB | 180ms | ~100MB |
Complex Data with Special Characters
csvmd handles complex CSV data efficiently, including:
- Quoted fields with embedded commas
- Multi-line content with newlines
- Pipe characters (
|) that need escaping - Unicode characters
| Dataset | Rows | Input Size | Processing Time |
|---|---|---|---|
| Complex Data | 1,000 | 147KB | 4ms |
| Complex Data | 10,000 | 1MB | 12ms |
Streaming Mode Benefits
For large files, use --stream to process data with constant memory usage:
- Memory Efficiency: Streaming mode uses constant memory regardless of file size
- Immediate Output: Results appear as soon as processing begins
- Large File Support: Handle files larger than available RAM
- Header Alignment: The
--alignoption works seamlessly with streaming mode, affecting only the header separator line without impacting memory usage or performance
# Process a 100MB file with constant ~10MB memory usage
# With custom alignment - no additional memory overhead