:clipboard: mdtable
mdtable is a Python built command line interface that lets you convert csv files into Markdown formatted tables easily. It also provides a Python API to use for your projects.
Installation
Run pip install mdtable
and check that the latest version is current installed by running mdtable —version
.
Usage
>>> mdtable [OPTIONS] INPUT_FILE
The options available are:
-a, --aligns TEXT Comma seperated list of 'l,r,c'
-p, --padding INTEGER Padding for raw Markdown Table formatting
-s, --save TEXT Path to save formatted markdown to
--delimiter TEXT Delimiter character in csv
--quotechar TEXT Quote character in csv
--escapechar TEXT Escape character in csv
--writemode TEXT Python write mode, e.g w+, w, a, a+
--version Show the version and exit.
--help Show this message and exit.
Example:
Suppose you have a file input.csv
like so:
Name,Department,Birthday Month
John Smith,Accounting,November
Erica Meyers,IT,March
Zain Patel,Engineering,June
Christopher Smith,Engineering,July
Kiseki Hirakawa,Human Resources,February
Running mdtable input.csv
results in:
| Name | Department | Birthday Month |
| ----------------- | --------------- | -------------- |
| John Smith | Accounting | November |
| Erica Meyers | IT | March |
| Zain Patel | Engineering | June |
| Christopher Smith | Engineering | July |
| Kiseki Hirakawa | Human Resources | February |
which looks like:
Name | Department | Birthday Month |
---|
John Smith | Accounting | November |
Erica Meyers | IT | March |
Zain Patel | Engineering | June |
Christopher Smith | Engineering | July |
Kiseki Hirakawa | Human Resources | February |
API
[soon] more documentation
Example:
from mdtable import MDTable
markdown = MDTable('in.csv')
markdown_string_table = markdown.get_table()
markdown.save_table('out.csv')
Current Features
Future Features