• Stars
    star
    642
  • Rank 70,096 (Top 2 %)
  • Language
    Python
  • License
    MIT License
  • Created over 10 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿ“๐Ÿ“Š Convert your CSV files into Markdown tables.

csvtomd: markdown tables made easy

ยป Now online: csvtomd.com ยป

The Python project is discontinued

Thanks for all your contributions! At this time I'm not continuing development on the Python version of this tool.

I'm moving work to the following JS projects:

I'm happy to point to your projects if you decide to take over development on the Python version or create a CLI for the JS version! Just let me know.


Excel โ€”> Markdown

CircleCI

Convert your CSV files into Markdown tables.

Tables Generator is a fantastic web tool for converting tabular data into all sorts of table layouts. I like how it lets me import CSV files, but I need the ability to convert many CSV files in batch for a docset on which I'm working.

I built csvtomd to convert one or more CSV files into nicely-padded Markdown tables. Now you can build your tables in Excel and convert them for use in GitHub Markdown files without having to construct them by hand.

Installation

This is a Python 3 script, so use pip3 to install:

pip3 install csvtomd

After this, run csvtomd --help from your terminal to verify it's installed properly.

Usage

csvtomd MY_SPREADSHEET.csv generates a Markdown table from MY_SPREADSHEET.csv.

csvtomd SHEET1.csv SHEET2.csv SHEET3.csv generates three Markdown tables from the input files and displays them alongside the input filename.

csvtomd or csvtomd - generates a Markdown table from standard input. You can type CSV data or pipe a file in.

Example Input

File: thrones.csv

First Name,Last Name,Location,Allegiance
Mance,Rayder,North of the Wall,Wildlings
Margaery,Tyrell,The Reach,House Tyrell
Danerys,Targaryen,Meereen,House Targaryen
Tyrion,Lannister,King's Landing,House Lannister

Example Markdown Table

Command: csvtomd thrones.csv

First Name Last Name Location Allegiance
Mance Rayder North of the Wall Wildlings
Margaery Tyrell The Reach House Tyrell
Danerys Targaryen Meereen House Targaryen
Tyrion Lannister King's Landing House Lannister

Example Raw Output

Command: csvtomd thrones.csv

First Name  |  Last Name  |  Location           |  Allegiance
------------|-------------|---------------------|-----------------
Mance       |  Rayder     |  North of the Wall  |  Wildlings
Margaery    |  Tyrell     |  The Reach          |  House Tyrell
Danerys     |  Targaryen  |  Meereen            |  House Targaryen
Tyrion      |  Lannister  |  King's Landing     |  House Lannister

Command: csvtomd --padding 0 thrones.csv

First Name|Last Name|Location         |Allegiance
----------|---------|-----------------|---------------
Mance     |Rayder   |North of the Wall|Wildlings
Margaery  |Tyrell   |The Reach        |House Tyrell
Danerys   |Targaryen|Meereen          |House Targaryen
Tyrion    |Lannister|King's Landing   |House Lannister

Requirements

Python 3.

Tested with Python 3.4.1 on Mac OS X 10.9.3.

Doesn't require any external packages, so it should be platform-agnostic.

Help

Command: csvtomd --help

usage: csvtomd.py [-h] [-n] [-p PADDING] [-d DELIMITER] csv_file [csv_file ...]

Read one or more CSV files and output their contents in the form of Markdown
tables.

positional arguments:
  csv_file              One or more CSV files to be converted

optional arguments:
  -h, --help            show this help message and exit
  -n, --no-filenames    Don't display filenames when outputting multiple
                        Markdown tables.
  -p PADDING, --padding PADDING
                        The number of spaces to add between table cells and
                        column dividers. Default is 2 spaces.
  -d DELIMITER, --delimiter DELIMITER
                        CSV delimiter, expected values: ',', ';'. Default is ,

Contributions

Bug reports, fixes, or features? Feel free to open an issue or pull request any time.

Testing

I only accept pull requests for features with tests.

# Run tests in the project root
$ py.test
============================= test session starts ==============================
platform darwin -- Python 3.5.0, pytest-3.0.5, py-1.4.31, pluggy-0.4.0
rootdir: /your/path/to/csvtomd, inifile:
collected 3 items

test/test_csvtomd.py ...

=========================== 3 passed in 0.04 seconds ===========================

Releasing

# Bump version number in setup.py and csvtomd.py
# Delete old builds
rm -rf dist
# Build source and binary wheel distribution
python setup_wrap.py sdist bdist_wheel
# Upload to PyPI
pip install twine
twine upload dist/*

Here's an actual guide to PyPI. And another really good one.

License

Copyright (c) 2017 Matthew Lewis. Licensed under the MIT License.

More Repositories

1

src2png

๐Ÿ“ธ๐Ÿ’ป Turn your source code into beautiful syntax-highlighted images.
JavaScript
2,195
star
2

osm-pathfinding

Apply A* to real life for once. Final project for UMN CSCI 4511W with @JoeSelvik and @kevana.
JavaScript
113
star
3

shed

Don't run "curl | sh" again. Use "curl | shed" to verify scripts before running.
Python
31
star
4

noble-bean

A Node app that talks to your LightBlue Bean.
JavaScript
18
star
5

bean-sous-vide

Build a DIY sous vide cooker with @PunchThrough's LightBlue Bean.
Objective-C
17
star
6

expose.py

Photojournalism static site generator, inspired by Jack000/Expose
Python
17
star
7

csvtomd-web

Generate Markdown tables from CSV data online.
JavaScript
16
star
8

coaxist

Single Docker container for running Plex with a Debrid service.
TypeScript
12
star
9

yot

A CLI for browsing 4chan text posts.
Python
10
star
10

big-red-slack-button

it's a big red button that posts to Slack
C++
9
star
11

csvtomd-lib

Generate Markdown tables from CSV data.
JavaScript
9
star
12

search-umn

Search the UMN People Directory (search.umn.edu) using a Python API.
Python
6
star
13

digiglass

Search Digi-Key from your terminal
Python
6
star
14

psdtojpg

Convert one or more PSD files to JPG format. Thumbnail and optimize them, or don't.
Python
6
star
15

bean-phant-logger

Use the LightBlue Bean to log data over time. Save your data to Sparkfun's free IoT storage service.
Python
6
star
16

clapify

Use๐Ÿ‘emoji๐Ÿ‘to๐Ÿ‘be๐Ÿ‘obnoxious๐Ÿ‘on๐Ÿ‘the๐Ÿ‘internet
HTML
5
star
17

freevite

Free event invite platform with ICS support
TypeScript
4
star
18

rails-vue-frontend-test-example

Ruby
4
star
19

osm-redis-processor

Store OSM XML data in Redis. Final project for UMN CSCI 4511W with @JoeSelvik and @kevana.
Java
4
star
20

whyvote.us

โœ…๐Ÿ—ณ Find out how much your vote really counts.
JavaScript
4
star
21

esp8266-iot-node

World's cheapest HomeKit node (soon)
C++
3
star
22

bluecat

A Python-based web server for printing to a cute cat printer.
Python
3
star
23

codeChan

An idea shamelessly stolen from codereddit.com, with an imageboard twist.
Python
3
star
24

bravo-vince

B R A V O V I N C E
JavaScript
2
star
25

arduino_i2c_term

A serial user interface for the I2C protocol accessed via Arduino.
Arduino
2
star
26

leweycoin

JavaScript
2
star
27

kicad-libraries

Personal parts and external libraries I use in my KiCad projects
OpenSCAD
2
star
28

gunship

Client and server code for operating the ACV Gunship.
Python
2
star
29

cuttlegame

Play RetroArch-compatible games online with friends via VNC server.
Dockerfile
2
star
30

phonedusk-client

Turn your iPhone into the world's most expensive burner.
Objective-C
2
star
31

pokemon-showoff

Show off your party from Pokemon Red, Blue, or Yellow by uploading a .sav file.
Python
2
star
32

verilive-server

Compile and execute Verilog modules and testbenches online. Built for Verilog.me.
Python
2
star
33

photolog

Static site generator for sharing your photos.
TypeScript
1
star
34

nrf_beep_server

An Arduino sketch to test Nordic NRF24L01+ wireless range. Server unit.
Arduino
1
star
35

memefax

JavaScript
1
star
36

AppRemoteSettings-iOS

Swift client. Update variables in your production iOS apps, live.
Swift
1
star
37

how-many-xbox

Vue
1
star
38

rachio-api

JavaScript
1
star
39

sternidae

Arduino
1
star
40

hypestream

Stream music from The Hype Machine. My first Swift app.
Objective-C
1
star
41

narcissa

Quantify yourself, free your data, and share it with the world.
Python
1
star
42

trumpimpea.ch

HTML
1
star
43

sugarcrane

Drop sugar cubes from your Bean+ powered quadcopter.
Swift
1
star
44

ripgui

JavaScript
1
star
45

arduino_simpleSeq

A simple Arduino sequencer to control one or more audio-generating ATtiny chips.
Arduino
1
star
46

useful-code-test

Ruby
1
star
47

figyr

Configure your Go app simply with zero configuration.
Go
1
star
48

attiny_slaveSynth

A simple ATtiny-based audio generator controlled by I2C.
Arduino
1
star
49

nrf_beep_client

An Arduino sketch to test Nordic NRF24L01+ wireless range. Remote unit.
Arduino
1
star
50

mplewis.github.com

mplewis' Github Pages repository
JavaScript
1
star
51

nodemcu-basecamp

NodeMCU dev board with more headers and level shifting
KiCad Layout
1
star
52

wheelplex

SPIN THAT WHEEL
Python
1
star
53

munified

A Muni scraper that takes into account walking distance. Partially from paulhammond/minimuni.
Python
1
star
54

mqtt-button

A project template for NodeMCU (ESP8266) projects using the Arduino framework.
C
1
star
55

umnClassParser

A Python script to parse University of Minnesota class information.
Python
1
star
56

pairbutton-server

Python
1
star
57

iverilog-netlist-processing

Parse Icarus Verilog netlists into Python structures.
Python
1
star
58

wikiwatcher-scraper

Watch your MediaWiki and rank your contributors. Scraper module. Built with love for @punchthrough.
Python
1
star
59

pokemon-save-parser

Access your Pokemon save data more easily with Python.
Python
1
star
60

accentor

Control your MPD/Mopidy music server from a Node.js web interface. Be social with your music.
JavaScript
1
star
61

bullduino-faster

Friendly Automated Speaking Technological Expert Running Coach
C++
1
star
62

metroTap

A quick and dirty Arduino sketch that averages BPM from taps.
Arduino
1
star
63

statichook

Push to Bitbucket, trigger a webhook, and upload your static site via SCP.
JavaScript
1
star
64

nodemcu-backstage

Adapter for NodeMCU and WS2811/12 lights
KiCad Layout
1
star
65

imgpipel

TypeScript
1
star
66

gwitter

Like Twitter for GitHub. Creep on yo friends' commit messages.
Python
1
star
67

obsessive-react-reflux-example

An example single-page app built with React and Reflux. Batteries included. Obsessively commented.
JavaScript
1
star
68

musicScalesTest

Testing a set of Arduino functions for generating musical scales.
C
1
star