Skip to content

Sai-Vignesh/ExcelColumn2PDF

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📄 Excel Column to PDF Exporter

This Python script allows you to convert each column in an Excel spreadsheet into its own centered, formatted PDF. Each column becomes a multi-page PDF, with each cell’s content centered on a separate page.

Perfect for generating print-ready PDFs from structured column data — such as flashcards, name tags, or individual labels.


✨ Features

  • 📊 Converts every non-empty column into its own PDF
  • 🧾 Each cell appears on its own page, centered and auto-sized
  • 💡 Dynamically adjusts font size to fit content
  • 🗂️ Automatically names output files using Excel-style column letters (A, B, ..., AA, etc.)
  • 📁 Saves all output to your ~/Downloads/outputs/ directory
  • 🖱️ Uses a file picker dialog for user-friendly Excel file selection
  • 🧪 Built with Pandas, ReportLab, and Tkinter

📦 Requirements

This project uses uv for dependency and environment management.

1. Install uv (if not already):

curl -LsSf https://astral.sh/uv/install.sh | sh

2. Set up the environment:

uv venv
uv pip install -r requirements.txt

If you don't have a requirements.txt, use:

uv pip install pandas reportlab

🚀 Usage

Run the script:

uv venv
source .venv/bin/activate   # or .venv\Scripts\activate on Windows
python your_script.py
  • A file dialog will appear — select your Excel file.
  • PDFs will be generated in: ~/Downloads/outputs/

📁 Example Output

If your Excel file is named Students.xlsx with data in columns A and B, the script will generate:

~/Downloads/outputs/
├── Students_Column_A.pdf
└── Students_Column_B.pdf

Each PDF contains one page per cell entry.


🧠 How It Works

  • Reads the Excel file without a header.
  • Iterates over each column.
  • Skips columns that are entirely blank or empty.
  • For each cell:
    • Formats date cells as MM/DD.
    • Splits long text to fit the page.
    • Adjusts font size to avoid overflow.
  • Outputs a single-page-per-cell PDF, with text centered vertically and horizontally.

🛠 Dependencies

  • pandas
  • reportlab
  • tkinter (usually comes preinstalled with Python)
  • uv (for virtual environment and dependency management)

📌 Notes

  • Only .xls and .xlsx files are supported.
  • Output folder is hardcoded to ~/Downloads/outputs/.
  • Text wrapping is basic — for more complex formatting, the script can be extended.

About

Converts each column in an Excel file into a separate PDF, placing one cell per page, centered and sized for easy reading or printing.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages