Spaces:
Sleeping
Sleeping
| from langchain.tools import tool | |
| def excel_food_sales_sum(file_path: str) -> str: | |
| """ | |
| Parses the Excel file and returns total sales of items classified as food. | |
| Assumes 'Item Type' and 'Sales USD' columns. | |
| """ | |
| try: | |
| df = pd.read_excel(file_path) | |
| df.columns = [col.strip().lower() for col in df.columns] | |
| food_rows = df[df['item type'].str.lower().str.contains("food")] | |
| total = food_rows['sales usd'].sum() | |
| return f"{total:.2f}" | |
| except Exception as e: | |
| return f"Excel parsing failed: {str(e)}" |