Skip to main content

md_table_writer

md_table_writer generates Markdown formatted table(s) from one or more data files and writes them to a Markdown file. Supported data file formats: CSV (.csv), NumPy (.npy), and Excel (.xlsx).

Download

pip install md_table_writer

Overview

md_table_writer converts data files into Markdown-formatted tables with column headers.

Multiple data files can be provided, and they are processed in order. If more than one data file is provided, all file specific options must be valid across all files. A new set of tables is generated for each provided data file. Generated tables are inserted into a Markdown file either at a specific line number or appended to the end of the file.

Number of Tables Generated per File

CSV and NumPy data files generate one table per file. Excel data files generate one table per sheet.

File Specific Arguments

CSV: Users can specify which column headers from the file to include through the -cols option. If -cols is not provided, all columns are included. The first row in the data file must be exclusively for column headers.

Excel: Option -sheets processes only select sheets. If -sheets is not provided, every sheet will be processed.

NumPy: Unlike the other two file types, column headers must be provided via -cols. The NumPy matrix should be data only: the first row should not contain column headers. The number of provided column headers must match the number of columns in the matrix.

Usage

md_table_writer f md -cols -sheets -align -line -append
Argument Description Required? Default Example
f Paths to the input data files; files are processed in their provided order Yes, must input at least one file path - data.xlsx
md Path to the target Markdown file Yes - report.md
-cols Column headers to process from data files No, unless at least one data file is a NumPy file All columns for CSV/Excel -cols Time Population
-sheets List of sheets from Excel file to generate tables for No All sheets -sheets Sheet1 Sheet2
-align Table column alignment options: left, center, or right No center -align right
-line Positive line number in Markdown file to insert No end of file -line 50
-append Append generated table to the end of the Markdown file No False -append

Argument Positioning

The only two positional arguments are f (paths to data files) and md (path to Markdown file). All data file paths must be specified before the Markdown file path. Both positional arguments must be provided before other options.

Examples

md_table_writer data.xlsx report.md -cols Time Population -sheets Sheet1 Sheet2 -align right -line 50

Generates two tables for Sheet1 and Sheet2 with columns Time and Population from data.xlsx. The table's columns are right aligned. The table is written on line 50 in report.md.

md_table_writer data.csv report.md -align left -append

Generates one table with all column headers in data.csv. The table's columns are left aligned. The table is written to the end of report.md.

md_table_writer data.npy report.md -cols Time Population -line 50

Generates one table from the 2D matrix in data.npy with column headers Time and Population. The table's columns are center aligned. The table is written on line 50 in report.md.

md_table_writer data.csv data.npy report.md -cols Time Population -line 50

Generates two tables, one from data.csv and the other from data.npy. Both tables have column headers Time and Population. The table's columns are center aligned. Both tables are written on line 50 in report.md.

Release files for md-table-writer 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for md-table-writer 1.1.0
File Size Uploaded
md_table_writer-1.1.0.tar.gz 8.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for md-table-writer 1.1.0
File Interpreter ABI Platform
md_table_writer-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.3 kB

Release files / md_table_writer-1.1.0.tar.gz

Download URL md_table_writer-1.1.0.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
7b79b7272a4d8ca531e5a27b7afe3a95699e46f37dfb32537befcb3d5f5f10c5
BLAKE2b-256 checksum
How to use checksums
4b0194bc98558688b0f476c37695adc3fbae8c92e5352e1d3c766c720dfc45f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.7

Release files / md_table_writer-1.1.0-py3-none-any.whl

Download URL md_table_writer-1.1.0-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d9ac366696628b3408b4893f998bc2c77dbe26ec092d575edf906e105438c75f
BLAKE2b-256 checksum
How to use checksums
00a1f8fd2f657524e57060ff8632772fd07770b80ff0acf793f9c86c867ece2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.7

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.0

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page