Skip to content

A Python application that automates invoice generation from Excel data, creating professional PDF invoices with customizable templates for business and freelance use.

Notifications You must be signed in to change notification settings

Sachethanv/app4-Invoice-generator

Repository files navigation

Invoice Generator 📄

A Python application that automates the generation of professional PDF invoices from Excel data. This tool streamlines the invoicing process by reading product details from Excel spreadsheets and creating formatted PDF invoices with company branding.

🎯 Overview

The Invoice Generator is designed to help businesses and freelancers quickly create professional invoices by automating the conversion of Excel-based order data into polished PDF documents. It eliminates manual invoice creation, reduces errors, and saves valuable time.

✨ Features

  • Automated PDF Generation: Converts Excel data into professional PDF invoices automatically
  • Batch Processing: Process multiple invoices from Excel files in one go
  • Product Table Generation: Automatically creates itemized product tables with pricing
  • Automatic Calculations: Computes totals including quantity, price per unit, and total price
  • Professional Formatting: Clean, business-ready invoice layout with proper spacing and alignment
  • Company Branding: Includes customizable company name and logo placement
  • Date Stamping: Automatically adds invoice dates for record-keeping
  • Invoice Numbering: Each invoice receives a unique identifier from the source data

🛠️ Tech Stack

  • Python 3.x: Core programming language
  • FPDF: PDF generation library for creating formatted documents
  • Pandas: Data manipulation and Excel file reading
  • openpyxl: Excel file handling engine

📋 Prerequisites

Before running this application, ensure you have:

  • Python 3.x installed on your system
  • pip (Python package manager)

🚀 Installation

  1. Clone the repository

    git clone https://github.com/Sachethanv/app4-Invoice-generator.git
    cd app4-Invoice-generator
  2. Install required dependencies

    pip install fpdf pandas openpyxl

📊 Excel File Format

Your Excel files should be structured with the following columns:

  • invoice_nr: Invoice number (e.g., 10001)
  • date: Invoice date (e.g., 2023.1.18)
  • product_id: Product identifier
  • product_name: Name of the product
  • amount_purchased: Quantity purchased
  • price_per_unit: Unit price
  • total_price: Total price (quantity × unit price)

Example Excel Structure:

invoice_nr date product_id product_name amount_purchased price_per_unit total_price
10001 2023.1.18 1 Product A 5 10.00 50.00
10001 2023.1.18 2 Product B 3 15.00 45.00

💻 Usage

  1. Prepare your Excel files

    • Place your invoice Excel files in the invoices/ directory
    • Ensure they follow the required format specified above
  2. Run the script

    python main.py
  3. Output

    • PDF invoices will be generated in the PDFs/ directory
    • Each invoice will be named according to its invoice number and date (e.g., 10001-2023.1.18.pdf)

📁 Project Structure

app4-Invoice-generator/
│
├── main.py                          # Main application script
├── invoices/                        # Input directory for Excel files
│   ├── 10001-2023.1.18 (1).xlsx   # Sample invoice data
│   ├── 10002-2023.1.18 (1).xlsx
│   └── 10003-2023.1.18 (1).xlsx
├── PDFs/                           # Output directory for generated PDFs
│   ├── 10001-2023.1.18 (1).pdf
│   ├── 10002-2023.1.18 (1).pdf
│   └── 10003-2023.1.18 (1).pdf
└── README.md                       # Project documentation

🎨 Customization

You can customize the invoice appearance by modifying the following in main.py:

  • Company Name: Update the company name text in the PDF header
  • Font Styles: Adjust font sizes, families, and styles
  • Colors: Modify cell backgrounds and text colors
  • Layout: Change spacing, margins, and table dimensions
  • Logo: Add or replace company logo images

📝 Example Output

Generated invoices include:

  • Invoice number and date in the header
  • Company name and branding
  • Itemized product table with:
    • Product ID
    • Product name
    • Quantity purchased
    • Price per unit
    • Total price per line item
  • Grand total at the bottom
  • Professional formatting suitable for business use

🤝 Contributing

Contributions are welcome! If you'd like to improve this project:

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

📄 License

This project is open source and available under the MIT License.

📧 Contact

Sachethan V


Made with ❤️ for automating business workflows

About

A Python application that automates invoice generation from Excel data, creating professional PDF invoices with customizable templates for business and freelance use.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages