Download backend/services/excel_reader.py from Abhisingh-18/HunterAI: direct link, hf CLI and curl.
- Browser
- Download file 638 Bytes
-
https://huggingface.co/Abhisingh-18/HunterAI/resolve/main/backend/services/excel_reader.py
- Command line
-
hf download hf://Abhisingh-18/HunterAI/backend/services/excel_reader.py
-
curl -L -o excel_reader.py https://huggingface.co/Abhisingh-18/HunterAI/resolve/main/backend/services/excel_reader.py
638 Bytes
| import pandas as pd | |
| def read_company_excel(file_path: str): | |
| try: | |
| if file_path.endswith('.csv'): | |
| df = pd.read_csv(file_path) | |
| else: | |
| df = pd.read_excel(file_path) | |
| # Normalize headers to lowercase? Or expected exact match? | |
| # User prompt: "Company Name | HR Name | Email | Role | Tech Stack | Type" | |
| # Let's clean up nan values first | |
| df = df.where(pd.notnull(df), None) | |
| companies = df.to_dict(orient="records") | |
| return companies | |
| except Exception as e: | |
| print(f"Error reading Excel/CSV: {e}") | |
| return [] | |