xlsx2md


Namexlsx2md JSON
Version 0.1.1 PyPI version JSON
download
home_pageNone
SummaryConvert Excel files (xlsx, xls) and CSV to Markdown tables
upload_time2025-07-17 00:26:54
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords excel xlsx xls csv markdown table converter
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # xlsx2md

[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![PyPI version](https://badge.fury.io/py/xlsx2md.svg)](https://badge.fury.io/py/xlsx2md)
[![CI/CD Pipeline](https://github.com/postovalov/xlsx2md/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/postovalov/xlsx2md/actions/workflows/ci.yml)
[![Coverage](https://img.shields.io/badge/coverage-80%25+-green.svg)](https://codecov.io/gh/postovalov/xlsx2md)
[![Code Quality](https://img.shields.io/badge/code%20quality-A-brightgreen.svg)](https://github.com/postovalov/xlsx2md)
[![Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![MyPy](https://img.shields.io/badge/mypy-checked-blue.svg)](http://mypy-lang.org/)
[![Pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)

**xlsx2md** is a powerful CLI tool for converting Excel files (`.xlsx`, `.xls`) and CSV to Markdown tables with support for multiple sheets, cell ranges, and various table styles.

## ✨ Features

- 🔄 **Format support**: Excel (.xlsx, .xls) and CSV files
- 📊 **Multiple sheets**: process all or selected sheets
- 🎨 **Table styles**: default, minimal, grid
- 📏 **Alignment**: left, center, right for columns
- 🔍 **Cell ranges**: process specific areas
- 📋 **File info**: view structure and metadata
- 🎯 **Flexible options**: empty cells, encodings, delimiters

## 🚀 Installation

### Using pip
```bash
pip install xlsx2md
```

### Using pipx (recommended)
```bash
pipx install xlsx2md
```

### From source
```bash
git clone https://github.com/postovalov/xlsx2md.git
cd xlsx2md
pip install -e .
```

## 🎯 Quick Start

### Basic usage
```bash
# Convert Excel file to Markdown
xlsx2md data.xlsx

# Convert with specific sheet
xlsx2md data.xlsx --sheet "Sheet2"

# Convert cell range
xlsx2md data.xlsx --range "A1:C10"

# Save to file
xlsx2md data.xlsx --output table.md
```

### Table style examples
```bash
# Default style
xlsx2md data.xlsx

# Minimal style
xlsx2md data.xlsx --style minimal

# Grid style
xlsx2md data.xlsx --style grid
```

## 📁 Supported Formats

| Format        | Extension | Description                |
|---------------|-----------|----------------------------|
| Excel 2007+   | `.xlsx`   | Modern Excel format        |
| Excel 97-2003 | `.xls`    | Legacy Excel format        |
| CSV           | `.csv`    | Text format with delimiter |

## 📖 Usage

### Basic syntax
```bash
xlsx2md [OPTIONS] FILE_PATH
```

### Parameters

#### Main parameter
- `FILE_PATH` - path to input file (required)

#### Sheet options
- `--sheet, -s TEXT` - sheet name or index (default: first sheet)
- `--all-sheets` - process all sheets
- `--sheets TEXT` - process specific sheets (1,3,5 or "Sheet1,Sheet3")
- `--list-sheets` - show all sheets

#### Range options
- `--range, -r TEXT` - cell range (e.g., A1:B10)

#### Output options
- `--output, -o PATH` - output file path (default: stdout)
- `--style TEXT` - table style: default, minimal, grid (default: default)
- `--align TEXT` - column alignment: left, center, right
- `--empty TEXT` - value for empty cells (default: empty string)

#### Info options
- `--info` - show file information
- `--version, -V` - show version and exit
- `--help, -h` - show help

## 📊 Examples

### 1. Basic conversion
```bash
xlsx2md sales_data.xlsx
```

**Result:**
```markdown
|  Product |  Q1 |  Q2 |  Q3 |  Q4 |
|----------|-----|-----|-----|-----|
| Widget A | 100 | 120 | 110 | 130 |
| Widget B |  80 |  90 |  85 |  95 |
| Widget C | 150 | 160 | 155 | 165 |
```

### 2. Table styles

#### Default style
```bash
xlsx2md data.xlsx --style default
```

#### Minimal style
```bash
xlsx2md data.xlsx --style minimal
```

**Result:**
```markdown
Product  |  Q1 |  Q2 |  Q3 |  Q4
---------|-----|-----|-----|-----
Widget A | 100 | 120 | 110 | 130
Widget B |  80 |  90 |  85 |  95
```

#### Grid style
```bash
xlsx2md data.xlsx --style grid
```

**Result:**
```markdown
+----------+-----+-----+-----+-----+
| Product  | Q1  | Q2  | Q3  | Q4  |
+----------+-----+-----+-----+-----+
| Widget A | 100 | 120 | 110 | 130 |
| Widget B | 80  | 90  | 85  | 95  |
+----------+-----+-----+-----+-----+
```

### 3. Column alignment
```bash
xlsx2md data.xlsx --align center
```

### 4. Handling empty cells
```bash
xlsx2md data.xlsx --empty "-"
```

### 5. Working with ranges
```bash
xlsx2md data.xlsx --range "B2:D5"
```

### 6. All sheets
```bash
xlsx2md data.xlsx --all-sheets --output all_tables.md
```

### 7. Specific sheets
```bash
xlsx2md data.xlsx --sheets "1,3,5"
xlsx2md data.xlsx --sheets "Sheet1,Sheet3"
```

### 8. File info
```bash
xlsx2md data.xlsx --list-sheets
xlsx2md data.xlsx --info
```

## ⚙️ Configuration

### Environment variables

| Variable                | Description                        | Default     |
|-------------------------|------------------------------------|-------------|
| `XLSX2MD_ENCODING`      | Encoding for CSV files             | `utf-8`     |
| `XLSX2MD_MAX_FILE_SIZE` | Max file size (MB)                 | `100`       |
| `XLSX2MD_MAX_ROWS`      | Max number of rows                 | `10000`     |
| `XLSX2MD_OUTPUT_FORMAT` | Output format                      | `markdown`  |
| `XLSX2MD_COLORS`        | Enable colored output              | `true`      |
| `XLSX2MD_VERBOSE`       | Verbose output                     | `false`     |
| `XLSX2MD_LOG_LEVEL`     | Logging level                      | `WARNING`   |

### Example usage
```bash
export XLSX2MD_ENCODING=cp1251
export XLSX2MD_MAX_FILE_SIZE=200
xlsx2md large_file.xlsx
```

## 🛠️ Development

### Install for development
```bash
git clone https://github.com/postovalov/xlsx2md.git
cd xlsx2md
pip install -e ".[dev]"
```

### Run tests
```bash
# All tests
pytest

# With coverage
pytest --cov=xlsx2md

# Specific tests
pytest tests/test_cli.py
```

### Code quality
```bash
# Formatting
black xlsx2md tests

# Linting
flake8 xlsx2md tests

# Type checking
mypy xlsx2md
```

### Pre-commit hooks
```bash
pre-commit install
pre-commit run --all-files
```

## 📋 Requirements

- Python 3.8+
- openpyxl >= 3.0.0
- xlrd >= 2.0.0
- typer >= 0.9.0
- rich >= 13.0.0

## 🤝 Contributing

1. Fork the repository
2. Create a new branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

## 📄 License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## 🐛 Issues

If you find a bug or have a suggestion, please create an issue on [GitHub](https://github.com/postovalov/xlsx2md/issues).

## 📈 Roadmap

- [ ] Google Sheets support
- [ ] Export to HTML tables
- [ ] Excel formulas support
- [ ] Interactive mode
- [ ] Plugin system for extensions

---

**Author**: Roman Postovalov
**Email**: rpostovalov@gmail.com
**GitHub**: [postovalov](https://github.com/postovalov)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "xlsx2md",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "excel, xlsx, xls, csv, markdown, table, converter",
    "author": null,
    "author_email": "Roman Postovalov <rpostovalov@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/1c/d8/b73dd146a5900634dd8c81bfea5a3ed96f2b6baf8f8525629340a3b8cb81/xlsx2md-0.1.1.tar.gz",
    "platform": null,
    "description": "# xlsx2md\n\n[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![PyPI version](https://badge.fury.io/py/xlsx2md.svg)](https://badge.fury.io/py/xlsx2md)\n[![CI/CD Pipeline](https://github.com/postovalov/xlsx2md/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/postovalov/xlsx2md/actions/workflows/ci.yml)\n[![Coverage](https://img.shields.io/badge/coverage-80%25+-green.svg)](https://codecov.io/gh/postovalov/xlsx2md)\n[![Code Quality](https://img.shields.io/badge/code%20quality-A-brightgreen.svg)](https://github.com/postovalov/xlsx2md)\n[![Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![MyPy](https://img.shields.io/badge/mypy-checked-blue.svg)](http://mypy-lang.org/)\n[![Pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)\n\n**xlsx2md** is a powerful CLI tool for converting Excel files (`.xlsx`, `.xls`) and CSV to Markdown tables with support for multiple sheets, cell ranges, and various table styles.\n\n## \u2728 Features\n\n- \ud83d\udd04 **Format support**: Excel (.xlsx, .xls) and CSV files\n- \ud83d\udcca **Multiple sheets**: process all or selected sheets\n- \ud83c\udfa8 **Table styles**: default, minimal, grid\n- \ud83d\udccf **Alignment**: left, center, right for columns\n- \ud83d\udd0d **Cell ranges**: process specific areas\n- \ud83d\udccb **File info**: view structure and metadata\n- \ud83c\udfaf **Flexible options**: empty cells, encodings, delimiters\n\n## \ud83d\ude80 Installation\n\n### Using pip\n```bash\npip install xlsx2md\n```\n\n### Using pipx (recommended)\n```bash\npipx install xlsx2md\n```\n\n### From source\n```bash\ngit clone https://github.com/postovalov/xlsx2md.git\ncd xlsx2md\npip install -e .\n```\n\n## \ud83c\udfaf Quick Start\n\n### Basic usage\n```bash\n# Convert Excel file to Markdown\nxlsx2md data.xlsx\n\n# Convert with specific sheet\nxlsx2md data.xlsx --sheet \"Sheet2\"\n\n# Convert cell range\nxlsx2md data.xlsx --range \"A1:C10\"\n\n# Save to file\nxlsx2md data.xlsx --output table.md\n```\n\n### Table style examples\n```bash\n# Default style\nxlsx2md data.xlsx\n\n# Minimal style\nxlsx2md data.xlsx --style minimal\n\n# Grid style\nxlsx2md data.xlsx --style grid\n```\n\n## \ud83d\udcc1 Supported Formats\n\n| Format        | Extension | Description                |\n|---------------|-----------|----------------------------|\n| Excel 2007+   | `.xlsx`   | Modern Excel format        |\n| Excel 97-2003 | `.xls`    | Legacy Excel format        |\n| CSV           | `.csv`    | Text format with delimiter |\n\n## \ud83d\udcd6 Usage\n\n### Basic syntax\n```bash\nxlsx2md [OPTIONS] FILE_PATH\n```\n\n### Parameters\n\n#### Main parameter\n- `FILE_PATH` - path to input file (required)\n\n#### Sheet options\n- `--sheet, -s TEXT` - sheet name or index (default: first sheet)\n- `--all-sheets` - process all sheets\n- `--sheets TEXT` - process specific sheets (1,3,5 or \"Sheet1,Sheet3\")\n- `--list-sheets` - show all sheets\n\n#### Range options\n- `--range, -r TEXT` - cell range (e.g., A1:B10)\n\n#### Output options\n- `--output, -o PATH` - output file path (default: stdout)\n- `--style TEXT` - table style: default, minimal, grid (default: default)\n- `--align TEXT` - column alignment: left, center, right\n- `--empty TEXT` - value for empty cells (default: empty string)\n\n#### Info options\n- `--info` - show file information\n- `--version, -V` - show version and exit\n- `--help, -h` - show help\n\n## \ud83d\udcca Examples\n\n### 1. Basic conversion\n```bash\nxlsx2md sales_data.xlsx\n```\n\n**Result:**\n```markdown\n|  Product |  Q1 |  Q2 |  Q3 |  Q4 |\n|----------|-----|-----|-----|-----|\n| Widget A | 100 | 120 | 110 | 130 |\n| Widget B |  80 |  90 |  85 |  95 |\n| Widget C | 150 | 160 | 155 | 165 |\n```\n\n### 2. Table styles\n\n#### Default style\n```bash\nxlsx2md data.xlsx --style default\n```\n\n#### Minimal style\n```bash\nxlsx2md data.xlsx --style minimal\n```\n\n**Result:**\n```markdown\nProduct  |  Q1 |  Q2 |  Q3 |  Q4\n---------|-----|-----|-----|-----\nWidget A | 100 | 120 | 110 | 130\nWidget B |  80 |  90 |  85 |  95\n```\n\n#### Grid style\n```bash\nxlsx2md data.xlsx --style grid\n```\n\n**Result:**\n```markdown\n+----------+-----+-----+-----+-----+\n| Product  | Q1  | Q2  | Q3  | Q4  |\n+----------+-----+-----+-----+-----+\n| Widget A | 100 | 120 | 110 | 130 |\n| Widget B | 80  | 90  | 85  | 95  |\n+----------+-----+-----+-----+-----+\n```\n\n### 3. Column alignment\n```bash\nxlsx2md data.xlsx --align center\n```\n\n### 4. Handling empty cells\n```bash\nxlsx2md data.xlsx --empty \"-\"\n```\n\n### 5. Working with ranges\n```bash\nxlsx2md data.xlsx --range \"B2:D5\"\n```\n\n### 6. All sheets\n```bash\nxlsx2md data.xlsx --all-sheets --output all_tables.md\n```\n\n### 7. Specific sheets\n```bash\nxlsx2md data.xlsx --sheets \"1,3,5\"\nxlsx2md data.xlsx --sheets \"Sheet1,Sheet3\"\n```\n\n### 8. File info\n```bash\nxlsx2md data.xlsx --list-sheets\nxlsx2md data.xlsx --info\n```\n\n## \u2699\ufe0f Configuration\n\n### Environment variables\n\n| Variable                | Description                        | Default     |\n|-------------------------|------------------------------------|-------------|\n| `XLSX2MD_ENCODING`      | Encoding for CSV files             | `utf-8`     |\n| `XLSX2MD_MAX_FILE_SIZE` | Max file size (MB)                 | `100`       |\n| `XLSX2MD_MAX_ROWS`      | Max number of rows                 | `10000`     |\n| `XLSX2MD_OUTPUT_FORMAT` | Output format                      | `markdown`  |\n| `XLSX2MD_COLORS`        | Enable colored output              | `true`      |\n| `XLSX2MD_VERBOSE`       | Verbose output                     | `false`     |\n| `XLSX2MD_LOG_LEVEL`     | Logging level                      | `WARNING`   |\n\n### Example usage\n```bash\nexport XLSX2MD_ENCODING=cp1251\nexport XLSX2MD_MAX_FILE_SIZE=200\nxlsx2md large_file.xlsx\n```\n\n## \ud83d\udee0\ufe0f Development\n\n### Install for development\n```bash\ngit clone https://github.com/postovalov/xlsx2md.git\ncd xlsx2md\npip install -e \".[dev]\"\n```\n\n### Run tests\n```bash\n# All tests\npytest\n\n# With coverage\npytest --cov=xlsx2md\n\n# Specific tests\npytest tests/test_cli.py\n```\n\n### Code quality\n```bash\n# Formatting\nblack xlsx2md tests\n\n# Linting\nflake8 xlsx2md tests\n\n# Type checking\nmypy xlsx2md\n```\n\n### Pre-commit hooks\n```bash\npre-commit install\npre-commit run --all-files\n```\n\n## \ud83d\udccb Requirements\n\n- Python 3.8+\n- openpyxl >= 3.0.0\n- xlrd >= 2.0.0\n- typer >= 0.9.0\n- rich >= 13.0.0\n\n## \ud83e\udd1d Contributing\n\n1. Fork the repository\n2. Create a new branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## \ud83d\udcc4 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## \ud83d\udc1b Issues\n\nIf you find a bug or have a suggestion, please create an issue on [GitHub](https://github.com/postovalov/xlsx2md/issues).\n\n## \ud83d\udcc8 Roadmap\n\n- [ ] Google Sheets support\n- [ ] Export to HTML tables\n- [ ] Excel formulas support\n- [ ] Interactive mode\n- [ ] Plugin system for extensions\n\n---\n\n**Author**: Roman Postovalov\n**Email**: rpostovalov@gmail.com\n**GitHub**: [postovalov](https://github.com/postovalov)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Convert Excel files (xlsx, xls) and CSV to Markdown tables",
    "version": "0.1.1",
    "project_urls": {
        "Homepage": "https://github.com/postovalov/xlsx2md",
        "Issues": "https://github.com/postovalov/xlsx2md/issues",
        "Repository": "https://github.com/postovalov/xlsx2md"
    },
    "split_keywords": [
        "excel",
        " xlsx",
        " xls",
        " csv",
        " markdown",
        " table",
        " converter"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "676b86bb9b7149d20f30b8ec79f899a671c814b86c4110d4f4bea556896df6be",
                "md5": "86c0ad6c2d1811b1ed3748850a20ef37",
                "sha256": "32ad193c5cbf655887e3cca563e30ac5c044fbaa2e63f84a12c21ae7a62033d9"
            },
            "downloads": -1,
            "filename": "xlsx2md-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "86c0ad6c2d1811b1ed3748850a20ef37",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 26046,
            "upload_time": "2025-07-17T00:26:53",
            "upload_time_iso_8601": "2025-07-17T00:26:53.130424Z",
            "url": "https://files.pythonhosted.org/packages/67/6b/86bb9b7149d20f30b8ec79f899a671c814b86c4110d4f4bea556896df6be/xlsx2md-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "1cd8b73dd146a5900634dd8c81bfea5a3ed96f2b6baf8f8525629340a3b8cb81",
                "md5": "98f3e7cf6afc4175b35841130120fa9f",
                "sha256": "90f5ef067996efdf1a661c0b3413424f9cf9b61158b6895c0d8a3efdf5a32159"
            },
            "downloads": -1,
            "filename": "xlsx2md-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "98f3e7cf6afc4175b35841130120fa9f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 30360,
            "upload_time": "2025-07-17T00:26:54",
            "upload_time_iso_8601": "2025-07-17T00:26:54.427437Z",
            "url": "https://files.pythonhosted.org/packages/1c/d8/b73dd146a5900634dd8c81bfea5a3ed96f2b6baf8f8525629340a3b8cb81/xlsx2md-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-17 00:26:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "postovalov",
    "github_project": "xlsx2md",
    "github_not_found": true,
    "lcname": "xlsx2md"
}
        
Elapsed time: 0.39886s