Pure Python COM package for Windows COM automation and interoperability
88
Build a utility that automates Excel to generate a formatted sales report. The utility should create a workbook, populate it with sales data, apply formatting, and calculate totals.
Create a new Excel workbook with a worksheet named "Sales Report". The worksheet should contain:
For each data row, calculate the Total column (Quantity × Price) and set it in the appropriate cell.
After all data rows, add a row with:
Apply the following formatting:
Save the workbook to a file named "sales_report.xlsx" in the current directory.
@generates
def generate_sales_report(output_path: str) -> None:
"""
Generate an Excel sales report with formatted data and calculations.
Args:
output_path: Path where the Excel file should be saved
Raises:
Exception: If COM automation fails or file cannot be saved
"""
passProvides COM automation support for interacting with Excel application.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/pypi-comtypesevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10