A complete system for automatically generating Excel reports with advanced analysis, graphs, and professional formatting. Transforms raw data into presentation-ready executive reports.
- π Automatic Report Generation: Creates complete Excel reports automatically
- π¨ Professional Formatting: Applies styles, colors, and automatic formatting
- π Integrated Charts: Automatically generates bar and line charts
- π Advanced Analytics: Calculates KPIs, trends, and statistics
- π Multiple Worksheets: Organizes data into themed worksheets
- πΌ Executive Summary: Creates a summary spreadsheet with key insights
- π― Top Performers: Identify top sellers, products, and regions
- π Time-Lapse Analysis: Tracks trends over time
- π Simulated Data: Generates sample data for demonstration purposes
- Python 3.7+
- pandas: Data manipulation and analysis Data
- openpyxl: Creating and formatting Excel files
- numpy: Numerical and statistical calculations
- matplotlib: Basic visualizations
- seaborn: Advanced statistical graphics
- dataclasses: Typed data structures
Python 3.7 or higher
pip (Python package manager)- Clone the repository:
git clone https://github.com/your-user/automated-report-generator.git
cd automated-report-generator- Install the dependencies:
pip install -r requirements.txtOr install manually:
pip install pandas openpyxl numpy matplotlib seabornpython main.pyfrom report_generator import ExcelReportGenerator, ReportConfig, DataGenerator
# Configuration
config = ReportConfig(
title="Sales Report Q1",
output_path="relatorio_vendas_q1.xlsx",
company_name="My Company"
)
# Generate Data
sales_data = DataGenerator.generate_sales_data(90)
# Create Report
generator = ExcelReportGenerator(config)
generator.generate_complete_report({"Sales": sales_data})# Generate Financial Data
financial_data = DataGenerator.generate_financial_data(12)
# Configure Report
config = ReportConfig(
title="Annual Financial Report",
output_path="relatorio_financeiro_2024.xlsx",
include_charts=True,
include_summary=True
)
# Generate Report
data_dict = {
"Financial Data": financial_data,
"Monthly Analysis": financial_data.groupby('mes').sum()
}
generator = ExcelReportGenerator(config)
generator.generate_complete_report(data_dict)from report_generator import ReportAnalyzer
# Analyze Data
analyzer = ReportAnalyzer(sales_data)
# Summary Statistics
stats = analyzer.get_summary_stats()
print(f"Total records: {stats['total_records']}")
# Top performers
top_sellers = analyzer.get_top_performers('seller', 'net_value', 5)
top_products = analyzer.get_top_performers('product', 'net_value', 5)
# Trend analysis
trend = analyzer.get_trend_analysis('data', 'net_value')config = ReportConfig(
title="Report Title", # Main Title
output_path="path/file.xlsx", # Output Path
include_charts=True, # Include charts
include_summary=True, # Include executive summary
auto_format=True, # Automatic formatting
company_name="Company Name" # Company name
)automated-report-generator/
βββ main.py # Main file
βββ report_generator.py # Generator classes
βββ requirements.txt # Dependencies
βββ README.md # Documentation
βββ reports/ # Generated reports
β βββ sales_report.xlsx
β βββ financial_report.xlsx
β βββ executive_report.xlsx
βββ data/ # Input data
β βββ sales_data.csv
β βββ financial_data.csv
βββ templates/ # Report Templates
βββ template_padrao.xlsx
- Detailed Sales: All sales records
- Top Sellers: Ranking by performance
- Top Products: Best-selling products
- Analysis by Region: Geographic distribution
- Monthly Trends: Evolution over time
- Financial Data: Revenue, costs, and profits
- Margin Analysis: Gross and net margin
- Monthly Growth: Growth rate
- Cost Analysis: Distribution of Expenses
- Projections: Future Trends
Main KPIs: Key metrics Overall Statistics: Data summary Insights: Points of attention Recommendations: Data-based suggestions
π¨ Automatic Formatting Applied Styles
Headings: Blue background, white text, bold Borders: Thin borders on all cells Alignment: Centered for headers Width: Auto-adjust based on content Colors: Professional color scheme
Automatic Charts
Bar Charts: For comparisons Line Charts: For time trends Positioning: Automatic next to data Styles: Predefined and professional
π Available Analyses Basic Statistics pythonsummary = analyzer.get_summary_stats()
Top Performers pythontop_items = analyzer.get_top_performers('column', 'value', 10)
Trend Analysis pythontrend = analyzer.get_trend_analysis('data', 'value')
π Example of Generated Data Sales Data python{ 'date': '2024-01-15', 'product': 'Product A', 'salesperson': 'John Smith', 'quantity': 5, 'unit_price': 299.99, 'net_value': 1274.95, 'region': 'South' } Financial Data python{ 'month': '2024-01', 'revenue': 150000.00, 'costs': 90000.00, 'net_profit': 45000.00, 'net_margin': 30.00 } π― Use Cases For Businesses
Monthly Reports: Automation of recurring reports Performance Analysis: KPI tracking Presentations: Reports for executive meetings
For Analysts
Data Analysis: Quickly transform data into insights Visualizations: Automated professional charts Ad-hoc Reports: Custom analyses
For Developers
Integration: Easy integration with existing systems Customization: Modular and extensible code Automation: Programmatic report generation
π€ Contributing
Fork the project Create a branch for your feature (git checkout -b feature/NewFunction) Commit your changes (git commit -m 'Add new feature') Push to the branch (git push origin feature/NewFunction) Open a Pull Request
π Upcoming Features
Web Dashboard: Web interface for configuration Multiple Formats: PDF, PowerPoint support Data Connectors: Database integration Custom Templates: Template system Scheduling: Scheduled automatic execution Notifications: Automatic email sending APIs: REST endpoints for integration Interactive Reports: Dynamic Dashboards
π Troubleshooting Error: "ModuleNotFoundError" bashpip install -r requirements.txt Error: "Permission denied" bash# Make sure the Excel file is not open
Error: "Invalid data format" bash# Make sure the data is in pandas DataFrame format
π License This project is licensed under the MIT License. See the LICENSE file for more details. π¨βπ» Author Your Name
GitHub: @Jbreccio LinkedIn: www.linkedin.com/in/josebreccio-dev-35b8292a4 Email: oibreccio@hotmail.com
π Thanks
Python community for the excellent documentation Openpyxl library developers Pandas community for making data analysis easier Everyone who contributed feedback and suggestions
β If this project helped you, leave a star! β