mdtable2csv
A very simple markdown table to CSV converter with no dependencies
Files
- Makefile
- README.md
- mdtable2csv.awk
- test.sh
- tests/.dir-locals.el
- tests/01-simple.csv
- tests/01-simple.md
- tests/02-separator.csv
- tests/02-separator.md
- tests/03-indented.csv
- tests/03-indented.md
- tests/04-indented-separator.csv
- tests/04-indented-separator.md
- tests/05-escaped-pipes.csv
- tests/05-escaped-pipes.md
- tests/06-whitespace-in-cells.csv
- tests/06-whitespace-in-cells.md
- tests/07-whitespace-in-separator.csv
- tests/07-whitespace-in-separator.md
- tests/08-trailing-whitespace.csv
- ...
View all 32 files
README.md
mdtable2csv.awk
A simple AWK script for converting Github-Flavoured Markdown tables to RFC4180 CSV spreadsheets. Consequently, it also has reasonable support for org-mode tables and general plain-text tables created using Emacs' table.el. I've been using this script with GAWK, but I believe it would work with other AWK implementations as well.
Installation and Usage
To install or uninstall just run make install
or make uninstall
as
root; PREFIX
defaults to /usr/local
.
Usage is dead simple with no options:
mdtable2csv < table.md > spreadsheet.csv
Note that the input must only contain a table, bizarre and undesirable things will happen if you try to convert an arbitrary markdown file. This is quite useful when used in conjunction with a text-editor that lets you pipe the selected region into an external program.
Bugs and Limitations
- Uneven rows are not supported and will result in mangled output.
- Forgoing leading or trailing pipes will result in columns being dropped
- We don't handle colon alignment directives very well.
- Org-mode table delimeter rows that use
+
rather than|
at cell boundaries are not supported.