Skip to content

mertizci/excelto

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

    ███████╗██╗  ██╗ ██████╗███████╗██╗     ████████╗ ██████╗ 
    ██╔════╝╚██╗██╔╝██╔════╝██╔════╝██║     ╚══██╔══╝██╔═══██╗
    █████╗   ╚███╔╝ ██║     █████╗  ██║        ██║   ██║   ██║
    ██╔══╝   ██╔██╗ ██║     ██╔══╝  ██║        ██║   ██║   ██║
    ███████╗██╔╝ ██╗╚██████╗███████╗███████╗   ██║   ╚██████╔╝
    ╚══════╝╚═╝  ╚═╝ ╚═════╝╚══════╝╚══════╝   ╚═╝    ╚═════╝ 
    ────────────────────────────────────────────────────────────
       EXCEL  →  DOCX  →  CSV  →  PDF
       Convert every sheet to separate files

excelto

Convert each sheet in an Excel file to separate DOCX, CSV, or PDF files. A Python CLI tool with no data loss, automatic cleanup, and full Unicode support.


Table of Contents


Installation

# Create and activate virtual environment
python -m venv .venv
source .venv/bin/activate   # Windows: .venv\Scripts\activate

# Install the project
pip install -e .

Or run directly from project root (with .venv present):

./excelto report.xlsx -f docx

Usage

Convert All Sheets

excelto report.xlsx -f docx    # DOCX
excelto report.xlsx -f csv     # CSV
excelto report.xlsx -f pdf     # PDF

Creates report_Sheet1.docx, report_Sheet2.csv, etc. for each sheet (format depends on -f).

Output Directory

excelto report.xlsx -f docx -o ./output

Single Sheet

excelto report.xlsx -f docx -s "Sheet1"

CSV Format

Plain data export (no styling):

excelto report.xlsx -f csv
excelto report.xlsx -f csv -o ./output
excelto report.xlsx -f csv -d ";"   # Semicolon delimiter (e.g. for Excel locales)

PDF Format

Landscape mode, fit to page width. Sheet name (and title suffix) is added to every page by default:

excelto report.xlsx -f pdf
excelto report.xlsx -f pdf -o ./output
excelto report.xlsx -f pdf -m 0.3   # Tighter margins (inches)
excelto report.xlsx -f pdf -t "Report Date: January 2024"   # Custom title suffix
excelto report.xlsx -f pdf --no-page-header   # Omit sheet name from pages

PDF output is landscape with tables fit to page width. No data loss: long cell content is split into multiple rows automatically.

Programmatic Usage

from excelto import ExcelConverter

with ExcelConverter("report.xlsx") as converter:
    # DOCX
    paths = converter.convert_all()
    path = converter.convert_sheet("Sheet1")
    
    # CSV
    paths = converter.convert_all_to_csv()
    path = converter.convert_sheet_to_csv("Sheet1")
    
    # PDF
    paths = converter.convert_all_to_pdf()
    path = converter.convert_sheet_to_pdf("Sheet1", title_suffix="January 2024")
    path = converter.convert_sheet_to_pdf("Sheet1", add_page_header=False)   # No header on pages

Features

DOCX

  • Each sheet → separate DOCX file
  • Table format preserved (Table Grid)
  • First row styled as bold header

CSV

  • Each sheet → separate CSV file
  • Plain data only, no styling
  • Configurable delimiter (comma, semicolon, etc.)
  • UTF-8 encoding

PDF

  • Each sheet → separate PDF file
  • Landscape layout, tables fit to page width
  • Sheet name + custom title on every page (optional, --no-page-header to disable)
  • No data loss: long cells split into multiple rows
  • Unicode/Turkish character support
  • Adjustable margins (-m)
  • Font size scales down for wide tables

Common

  • Empty rows and columns removed automatically
  • Empty or header-only sheets skipped
  • Invalid filename characters sanitized

Testing

pip install -e ".[dev]"
pytest tests -v

License

MIT License – see LICENSE for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published