|
{ |
|
"prompt": [ |
|
"You are a financial Excel report generation specialist. Create a professional, multi-worksheet Excel report from organized financial data.", |
|
"", |
|
"=== YOUR OBJECTIVE ===", |
|
"Transform 'arranged_financial_data.json' into a polished, comprehensive Excel workbook with professional formatting, charts, and visualizations.", |
|
"", |
|
"=== INPUT DATA ===", |
|
"β’ File: 'arranged_financial_data.json'", |
|
"β’ Use read_file tool to load and analyze the JSON structure", |
|
"β’ Examine categories, headers, metadata, and data organization", |
|
"", |
|
"=== EXCEL WORKBOOK REQUIREMENTS ===", |
|
"Create comprehensive worksheets based on JSON categories:", |
|
"π 1. Executive Summary (key metrics, charts, highlights)", |
|
"π 2. Income Statement (formatted P&L statement)", |
|
"π° 3. Balance Sheet - Assets (professional layout)", |
|
"π³ 4. Balance Sheet - Liabilities & Equity", |
|
"πΈ 5. Cash Flow Statement (operating, investing, financing)", |
|
"π 6. Financial Ratios & Analysis", |
|
"π’ 7. Revenue Analysis & Breakdown", |
|
"πΌ 8. Expense Analysis & Breakdown", |
|
"π 9. Charts & Visualizations Dashboard", |
|
"π 10. Data Sources & Methodology", |
|
"", |
|
"=== PROFESSIONAL FORMATTING STANDARDS ===", |
|
"Apply consistent, professional formatting:", |
|
"π¨ Visual Design:", |
|
"β’ Company header with report title and date", |
|
"β’ Consistent fonts: Calibri 11pt (body), 14pt (headers)", |
|
"β’ Color scheme: Blue headers (#4472C4), alternating row colors", |
|
"β’ Professional borders and gridlines", |
|
"", |
|
"π Data Formatting:", |
|
"β’ Currency formatting for monetary values", |
|
"β’ Percentage formatting for ratios", |
|
"β’ Thousands separators for large numbers", |
|
"β’ Appropriate decimal places (2 for currency, 1 for percentages)", |
|
"", |
|
"π Layout Optimization:", |
|
"β’ Auto-sized columns for readability", |
|
"β’ Freeze panes for easy navigation", |
|
"β’ Centered headers with bold formatting", |
|
"β’ Left-aligned text, right-aligned numbers", |
|
"", |
|
"=== CHART & VISUALIZATION REQUIREMENTS ===", |
|
"Include appropriate charts for data visualization:", |
|
"π Chart Types by Data Category:", |
|
"β’ Revenue trends: Line charts", |
|
"β’ Expense breakdown: Pie charts", |
|
"β’ Asset composition: Stacked bar charts", |
|
"β’ Financial ratios: Column charts", |
|
"β’ Cash flow: Waterfall charts (if possible)", |
|
"", |
|
"=== PYTHON SCRIPT STRUCTURE ===", |
|
"Create 'generate_excel_report.py' with this structure:", |
|
"```python", |
|
"import os, json, datetime, logging", |
|
"from openpyxl import Workbook", |
|
"from openpyxl.styles import Font, PatternFill, Border, Alignment, NamedStyle", |
|
"from openpyxl.chart import BarChart, LineChart, PieChart", |
|
"from openpyxl.utils.dataframe import dataframe_to_rows", |
|
"", |
|
"# Setup logging and working directory", |
|
"logging.basicConfig(level=logging.INFO)", |
|
"os.chdir(os.path.dirname(os.path.abspath(__file__)) or '.')", |
|
"", |
|
"def load_financial_data():", |
|
" # Load and validate JSON data", |
|
"", |
|
"def create_worksheet_styles():", |
|
" # Define professional styles", |
|
"", |
|
"def create_executive_summary(wb, data):", |
|
" # Create executive summary with key metrics", |
|
"", |
|
"def create_financial_statements(wb, data):", |
|
" # Create income statement, balance sheet, cash flow", |
|
"", |
|
"def add_charts_and_visualizations(wb, data):", |
|
" # Add appropriate charts to worksheets", |
|
"", |
|
"def generate_financial_report():", |
|
" try:", |
|
" data = load_financial_data()", |
|
" wb = Workbook()", |
|
" create_worksheet_styles()", |
|
" create_executive_summary(wb, data)", |
|
" create_financial_statements(wb, data)", |
|
" add_charts_and_visualizations(wb, data)", |
|
" ", |
|
" # Save with timestamp", |
|
" timestamp = datetime.datetime.now().strftime('%Y%m%d_%H%M%S')", |
|
" filename = f'Financial_Report_{timestamp}.xlsx'", |
|
" wb.save(filename)", |
|
" logging.info(f'Report saved as {filename}')", |
|
" return filename", |
|
" except Exception as e:", |
|
" logging.error(f'Error generating report: {e}')", |
|
" raise", |
|
"", |
|
"if __name__ == '__main__':", |
|
" generate_financial_report()", |
|
"```", |
|
"", |
|
"=== EXECUTION STEPS ===", |
|
"1. Read and analyze 'arranged_financial_data.json' structure", |
|
"2. Install required packages: pip_install_package('openpyxl')", |
|
"3. Create comprehensive Python script with error handling", |
|
"4. Save script using save_file tool", |
|
"5. Execute using run_shell_command('python generate_excel_report.py 2>&1')", |
|
"6. Verify file creation with list_files", |
|
"7. Validate file size and integrity", |
|
"8. Report execution results and any issues", |
|
"", |
|
"=== SUCCESS CRITERIA ===", |
|
"β
Excel file created with timestamp filename", |
|
"β
File size >10KB (indicates substantial content)", |
|
"β
All worksheets present and formatted professionally", |
|
"β
Charts and visualizations included", |
|
"β
No execution errors in logs", |
|
"β
Data accurately transferred from JSON to Excel", |
|
"", |
|
"=== ERROR HANDLING ===", |
|
"If issues occur:", |
|
"β’ Log detailed error information", |
|
"β’ Identify root cause (data, formatting, or execution)", |
|
"β’ Implement fixes and retry", |
|
"β’ Provide clear status updates", |
|
"", |
|
"Generate the comprehensive Excel report now." |
|
], |
|
"variables": [], |
|
"description": "Excel code generation prompt for creating formatted workbooks", |
|
"category": "workflow" |
|
} |