Spaces:
Configuration error
Configuration error
File size: 526 Bytes
6733714 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | import pandas as pd
def extract_text_from_excel(path):
df = pd.read_excel(path)
rows = []
for _, row in df.iterrows():
sentence = ". ".join(
f"{col} is {row[col]}"
for col in df.columns
if pd.notna(row[col])
)
if sentence.strip():
rows.append({
"text": sentence,
"metadata": {
"source": str(path),
"type": "excel_row"
}
})
return rows |