File size: 638 Bytes
cc6cee7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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 []