Skip to content

Commit

Permalink
filter excel empty sheet (langgenius#8194)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnJyong authored and lau-td committed Oct 23, 2024
1 parent 2d7223d commit e76b943
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion api/core/rag/extractor/excel_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ def extract(self) -> list[Document]:
for sheet_name in wb.sheetnames:
sheet = wb[sheet_name]
data = sheet.values
cols = next(data)
try:
cols = next(data)
except StopIteration:
continue
df = pd.DataFrame(data, columns=cols)

df.dropna(how='all', inplace=True)
Expand Down

0 comments on commit e76b943

Please sign in to comment.