About Anaconda Help Download Anaconda

Meepio / packages / csvtomd 0.3.0

  • 3 total downloads
  • Last upload: 2 years and 9 months ago

Installers

pip install

To install this package run one of the following:
pip install -i https://pypi.anaconda.org/meepio/simple csvtomd

Description

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:

* csvtomd lib * csvtomd web

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.
    <div class="codehilite">
    <pre><span></span><code><span class="c1"># Run tests in the project root</span>
    $<span class="w"> </span>py.test
    <span class="o">=============================</span><span class="w"> </span><span class="nb">test</span><span class="w"> </span>session<span class="w"> </span><span class="nv">starts</span><span class="w"> </span><span class="o">==============================</span>
    platform<span class="w"> </span>darwin<span class="w"> </span>--<span class="w"> </span>Python<span class="w"> </span><span class="m">3</span>.5.0,<span class="w"> </span>pytest-3.0.5,<span class="w"> </span>py-1.4.31,<span class="w"> </span>pluggy-0.4.0
    rootdir:<span class="w"> </span>/your/path/to/csvtomd,<span class="w"> </span>inifile:
    collected<span class="w"> </span><span class="m">3</span><span class="w"> </span>items

    test/test_csvtomd.py<span class="w"> </span>...

    <span class="o">===========================</span><span class="w"> </span><span class="m">3</span><span class="w"> </span>passed<span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="m">0</span>.04<span class="w"> </span><span class="nv">seconds</span><span class="w"> </span><span class="o">===========================</span>
    </code></pre>
    </div>


    ## Releasing
    <div class="codehilite">
    <pre><span></span><code><span class="c1"># Bump version number in setup.py and csvtomd.py</span>
    <span class="c1"># Delete old builds</span>
    rm<span class="w"> </span>-rf<span class="w"> </span>dist
    <span class="c1"># Build source and binary wheel distribution</span>
    python<span class="w"> </span>setup_wrap.py<span class="w"> </span>sdist<span class="w"> </span>bdist_wheel
    <span class="c1"># Upload to PyPI</span>
    pip<span class="w"> </span>install<span class="w"> </span>twine
    twine<span class="w"> </span>upload<span class="w"> </span>dist/*
    </code></pre>
    </div>


    [Here's an actual guide to PyPI.](https://packaging.python.org/distributing/) [And another really good one.](https://hynek.me/articles/sharing-your-labor-of-love-pypi-quick-and-dirty/)

    # License

    Copyright (c) 2017 Matthew Lewis. Licensed under [the MIT License](http://opensource.org/licenses/MIT).

© 2024 Anaconda, Inc. All Rights Reserved. (v4.0.4) Legal | Privacy Policy