A comprehensive PyQt5 desktop application for generating utility bill PDFs from Excel data and automatically sending them via Gmail. Perfect for property managers, landlords, or businesses that need to generate and distribute multiple utility bills efficiently.
- Water Bills - Generate water utility bills with consumption tracking
- Electric Bills - Create electricity bills with usage calculations
- Custom Templates - Flexible PDF generation from Excel data
- Gmail OAuth 2.0 - Secure authentication (no app passwords needed)
- Batch Email Sending - Send multiple bills with progress tracking
- Email Retry System - Retry failed sends with one click
- Smart Error Handling - User-friendly error messages with solutions
- Real-time Status Tracking - Monitor PDF generation and email status
- Context Menu Actions - Right-click to open, retry, or manage PDFs
- Failed PDF Recovery - Easy retry for failed generations or sends
- Live Progress Updates - Visual feedback during operations
- Clean Design - Modern PyQt5 interface with intuitive controls
- Responsive Layout - Adapts to different screen sizes
- Status Indicators - Color-coded status for easy monitoring
- Threaded Operations - Non-blocking UI during long operations
- Executable Building - One-click compilation to Windows/macOS executables
- Comprehensive Logging - Detailed but clean error reporting
- OAuth Management - Built-in Gmail logout and re-authentication
- Settings Persistence - Automatic saving of user preferences
- Python 3.7 or higher
- Gmail account with OAuth 2.0 credentials
- Excel files with utility data
-
Clone the repository:
git clone <repository-url> cd excelPDF
-
Install dependencies:
pip install -r requirements.txt
-
Set up Gmail OAuth:
- Go to Google Cloud Console
- Create a new project or select existing one
- Enable Gmail API
- Create OAuth 2.0 credentials (Desktop application)
- Download
credentials.jsonfile
-
Run the application:
python app.py
-
Configure OAuth:
- Click "Browse" next to "Credentials File"
- Select your downloaded
credentials.json - Click "β Help" for detailed OAuth setup instructions
-
First-time Authentication:
- Click "Send Emails" to trigger OAuth flow
- Browser will open for Google account authentication
- Grant permissions for Gmail access
- Token will be saved for future use
-
Account Management:
- Use "πͺ Logout" button to switch accounts
- Re-authenticate anytime by logging out first
Your Excel files should contain columns for:
- Names/Recipients - Customer or tenant names
- Email Addresses - Destination emails
- Usage Data - Consumption values (water/electricity)
- Billing Information - Amounts, dates, account numbers
-
Select Tab:
- Choose "Water" or "Electric" tab
- Each tab has independent settings
-
Configure Settings:
- Excel File: Select your data file
- Output Directory: Choose where PDFs are saved
- Email Settings: Configure sender details
-
Generate PDFs:
- Click "Generate PDFs" button
- Monitor progress in the PDF list
- Green = Success, Red = Failed, Blue = In Progress
-
Send Emails:
- Review generated PDFs in the list
- Click "Send Emails" to batch send
- Use context menu for individual operations
- Right-click failed PDFs β "π Retry Generation"
- Or click "π Remove Failed PDFs" to clean up
- Right-click failed emails β "π Retry Failed Email"
- Or click "π Retry Failed Emails" for bulk retry
- PDFs automatically reset to sendable status
Create standalone executables for distribution without requiring Python installation.
# macOS/Linux
./build.sh current # Build for current platform
./build.sh windows # Build for Windows
./build.sh macos # Build for macOS
# Windows
build.bat current # Build for current platform
build.bat windows # Build for Windows# Full control with Python script
python build_executable.py windows --onefile --clean
python build_executable.py macos --debug
python build_executable.py --help # See all options- Single File:
dist/UtilityBills.exe(Windows) ordist/UtilityBills(macOS) - Directory:
dist/UtilityBills/(faster startup, multiple files)
excelPDF/
βββ app.py # Main application entry point
βββ base_utility_tab.py # Core UI and functionality
βββ waterPage.py # Water-specific implementations
βββ electricPage.py # Electric-specific implementations
βββ mail_module.py # Gmail integration and OAuth
βββ data_lib.py # Data processing utilities
βββ base_doc.py # PDF generation base classes
βββ appLayout.ui # Qt Designer UI file
βββ requirements.txt # Python dependencies
βββ build_executable.py # Executable build script
βββ build.sh # Unix build helper
βββ build.bat # Windows build helper
βββ README.md # This file
βββ pdfs/ # Generated PDF output directory
- All settings automatically saved on change
- OAuth tokens stored securely
- Email configurations preserved between sessions
data.json- Water utility settingsdata2.json- Electric utility settingstoken.pickle- Gmail OAuth token (auto-generated)
- Solution: Click "πͺ Logout" then re-authenticate
- Cause: Expired or invalid OAuth token
- Solution: Regenerate PDFs before sending emails
- Cause: PDF was deleted or generation failed
- Solution: Check OAuth scope and re-authenticate
- Cause: Incorrect OAuth permissions
- Solution: Verify Excel file has required columns
- Cause: Missing or incorrectly named data columns
Run with debug logging:
python build_executable.py current --debug- Console Output: Real-time status in application
- Error Details: Displayed in user-friendly dialog boxes
- No Password Storage - Uses secure OAuth tokens only
- Local Token Storage - Credentials stored locally, not transmitted
- Scope Limitation - Only requests necessary Gmail permissions
- Secure Authentication - Google-managed authentication flow
- Local Processing - All data processing happens locally
- No Cloud Storage - Excel data and PDFs remain on your system
- Encrypted Tokens - OAuth tokens stored in encrypted format
- Fork the repository
- Create a feature branch:
git checkout -b feature/new-feature - Commit changes:
git commit -am 'Add new feature' - Push to branch:
git push origin feature/new-feature - Submit a Pull Request
- Operating System: Windows 10+, macOS 10.14+, or Linux
- Python: 3.7 or higher
- Memory: 4GB RAM recommended
- Storage: 100MB+ free space for installation
PyQt5>=5.15.0 # GUI framework
openpyxl>=3.0.0 # Excel file processing
requests>=2.25.0 # HTTP requests
pdfkit>=1.0.0 # PDF generation
google-auth>=2.0.0 # Google authentication
google-auth-oauthlib>=1.0.0 # OAuth implementation
google-auth-httplib2>=0.1.0 # HTTP transport
google-api-python-client>=2.0.0 # Gmail API
PyInstaller>=5.0.0 # Executable building
Pillow>=8.0.0 # Image processing (optional)
This project is licensed under the MIT License - see the LICENSE file for details.
- Issues: Report bugs or request features via GitHub Issues
- Documentation: Check this README and inline help tooltips
- OAuth Help: Click "β Help" button in email settings for setup guide
- Developer: Utility Bills Team
- Version: 1.0.4
- Last Updated: 2025
β
Automated Workflow - Generate hundreds of bills in minutes
β
Professional PDFs - Clean, consistent bill formatting
β
Secure Email - OAuth 2.0 authentication, no passwords
β
Error Recovery - Smart retry system for failed operations
β
Cross-Platform - Works on Windows, macOS, and Linux
β
Standalone Builds - No Python installation required for end users
β
User-Friendly - Intuitive interface with helpful error messages
Made with β€οΈ for efficient utility bill management