xlsx2md-cli
v1.8.1
Published
CLI tool for converting OpenXML spreadsheet documents to Pandoc's markdown grid tables.
Readme
xlsx2md-cli
A command-line tool for converting OpenXML spreadsheet documents (.xlsx) to Pandoc-compatible Markdown grid tables.
Features
- Convert Excel spreadsheets to Markdown grid table format
- Support for multiple sheets within a workbook
- Flexible output options (STDOUT or file)
- STDIN input support for piping
- Configurable line width for table formatting
- Locale-aware number and date formatting
- Row trimming for selective data extraction
- Sheet and table naming customization
Installation
npm install -g xlsx2md-cliOr install locally:
npm install xlsx2md-cliUsage
xlsx2md [options] [source]Arguments
| Argument | Description |
|----------|--------------------------------------------------------|
| source | Path to an .xlsx file. If omitted, reads from STDIN. |
Options
| Option | Description |
|------------------------------|-----------------------------------------------------------------------------------------|
| -V, --version | Output the version number |
| -v, --verbose | Always write the result to STDOUT. |
| --list | List all sheet names in the workbook |
| -o, --output-path <FILE> | Write output to a file instead of STDOUT |
| -n, --table-name <NAME...> | Specify custom table name(s) for each sheet |
| -s, --sheet-name <NAME...> | Specify one or more sheets in the workbook by name. If omitted, the first sheet is used |
| -w, --line-width <WIDTH> | Set maximum characters per line. Defaults to terminal width or 72 |
| -r, --use-raw-string | Disable string escaping in cell content |
| -t, --trim-rows <RANGE...> | Extract only rows within the specified range(s), format: "start[,end]" |
| -l, --locale <LOCALE> | Set localization for number/date formatting. Defaults to system locale |
| -h, --help | Display help information |
Examples
Convert the first sheet
xlsx2md -v -o output.md sample.xlsxConvert a specific sheet by name
xlsx2md -v -o output.md -s "Sheet1" sample.xlsxConvert multiple sheets
xlsx2md -v -o output.md -s "Sheet1" -s "Sheet2" sample.xlsxList all sheet names
xlsx2md --list sample.xlsxSet custom table names
xlsx2md -o output.md -s "Sheet1" -n "My Table" sample.xlsxTrim rows to a specific range
xlsx2md -o output.md -t "1,10" sample.xlsxExtract rows from 5 to the end:
xlsx2md -o output.md -t "5,0" sample.xlsxUse STDIN input
cat sample.xlsx | xlsx2md > output.mdSet custom line width
xlsx2md -w 120 -o output.md sample.xlsxDisable string escaping
xlsx2md -r -o output.md sample.xlsxSet locale for formatting
xlsx2md -l "en-US" -o output.md sample.xlsxOutput Format
The tool generates Pandoc-compatible Markdown grid tables, which can be rendered by Pandoc and other Markdown processors that support grid table syntax.
License
MIT
