DEV Community

515hikaru
515hikaru

Posted on • Edited on • Originally published at post-515hikaru.netlify.com

Convert Markdown Table to CSV

I created mdtable2csv command for me.

515hikaru/mdtable2csv: Convert markdown table to csv

Why?

I often use Markdown Tables generator because of writing table with markdown is too difficult for me. However, I had one problem. Markdown Tables generator cannot reverse transform, for example, markdown table to CSV. Because of this, I was reluctant to edit the table once I wrote it.

I always use a spreadsheet like Microsoft Excel to edit a table because I don't want to worry about anything other than the contents of the cell. If you can do the reverse conversion, you can edit the table by converting the table once written markdown into CSV and paying attention only to the contents of the cell.

Language and Implementation

I knew it was very easy before I made it. At least if you have a Markdown parser and a CSV parser, you can just connect them. Both were in Golang, and above all I wanted to make it easier to run on multiple machines.

It's so easy that everything goes just with the go get command.

Impressions

To be honest, it's not the quality that people can still use, but I've been freed from the trivial (and still not negligible) stress of everyday life. This is the best part of programming.

Top comments (4)

Collapse
 
xuri profile image
xuri

I would really recommend trying this library:

github.com/xuri/excelize

Excelize is a library written in pure Go providing a set of functions that allow you to write to and read from XLSX / XLSM / XLTM files. Supports reading and writing spreadsheet documents generated by Microsoft Excelβ„’ 2007 and later. Supports complex components by high compatibility, and provided streaming API for generating or reading data from a worksheet with huge amounts of data.

Collapse
 
evanplaice profile image
Evan Plaice

Really cool

It's not every day that a dev takes the leap and dives into writing a parser.

Understanding language itself is like unlocking a dev super power. Eventually, languages go from difficult to understand to just another vatiation of terminals, non-terminals, and rulesets.

Welcome to the club πŸ‘πŸ‘πŸ‘πŸ‘

Collapse
 
ooooo profile image
OOOOO

Wonderful tool, Maybe TableConvert.com can solve more problems, such as markdown to Excel, markdown to csv and so on, you can also edit the imported data online

Collapse
 
515hikaru profile image
515hikaru

It's a great solution! Thank you!