csv-to-md

command module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2025 License: MIT Imports: 16 Imported by: 0

README

CSV To Markdown Table Converter

This is a utility tool used to convert Comma-separated values (CSV) files to a Markdown table. The tool was written with Go, a programming language known for being fantastic with string processing, great performance and a collection of other great features.

Table Of Contents

Usage

The easiest and recommended way to use this tool is through the command line. Download the .exe executable file and run the tool from a terminal of your choice.

An example command to run the tool can look like this:

./csv-to-md.exe -inputFile=input.csv -outputToWindow -align=0 -autoCopy

Configuration Options

The program offers a range of different configuration options to customize the tool to best fit your use case.

Align

(Optional)

This option decides should text be aligned in the table. Available choices:

  • 0 - Center (default)
  • 1 - Left
  • 2 - Right
Example
./csv-to-md.exe -align=1
Auto Copy

(Optional)

Whether the converted table should automatically be copied into the device's clipboard.

Example
./csv-to-md.exe -autoCopy
Delimiter

(Optional)

Set the delimiter character for the CSV parser. If not given, the comma , character will be used. This can come in handy when your CSV file use different delimiters than the popular comma.

Example
./csv-to-md.exe -delimiter=;
Input File

The path to the input CSV file to be converted. This can be either absolute or relative path.

NOTE: This should be used mutual exclusively with URL (meaning only one of them should be used at a time)

Example
./csv-to-md.exe -inputFile=C:/temp/input.csv
Output To Window

(Optional)

Renders the converted table to the console running the program.

Example
./csv-to-md.exe -outputToWindow
URL

The URL from which the CSV data can be fetched from. For this to work, the HTTPS response sent by the server must set the Media Type to text/csv; charset=utf-8 and the return status code must be in range of success (200-299) or redirection (300-399). Last but not least, the response body should contain only the CSV data and nothing else.

NOTE: This should be used mutual exclusively with Input File (meaning only one of them should be used at a time).

Example
./csv-to-md.exe -url=https://raw.githubusercontent.com/askmedia/datalogue/master/olympics/winter_olympics_medals.csv
Verbose Logging

(Optional)

Should detailed diagnostic messages be logged? By default, these messages are kept out of the process to avoid polluting the program output and prevent unnecessary information from confusing users. It could be helpful to track down the problem when the program execution went wrong.

Example
./csv-to-md.exe -verboseLogging

Performance

I did not create a very proper setup to measure the performance. Ran it with my own PC so take it with a grain of salt. Data for these runs was generated from Faker library, specifically their person and address types.

Rows Columns Average Execution Time (5 runs)
1.000 10 29ms
10.000 10 2,1s
50.000 10 48,2s
100.000 10 3 minutes

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL