File size: 543 Bytes
9779920
f931a9d
 
9779920
f931a9d
9876236
f931a9d
 
 
 
 
9876236
 
f931a9d
577e5e5
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import pandas as pd
import requests
from io import BytesIO

def analyze_excel(path_or_url: str) -> str:
    try:
        if path_or_url.startswith("http"):
            response = requests.get(path_or_url)
            df = pd.read_excel(BytesIO(response.content))
        else:
            df = pd.read_excel(path_or_url)
    except Exception as e:
        return f"Error reading Excel file: {e}"

    # Just a simple analysis, can expand if you want
    return f"Rows: {df.shape[0]}, Columns: {df.shape[1]}, Columns: {', '.join(df.columns)}"