To avoid assertion while no rows in excel (#197)

### What problem does this PR solve?

_Briefly describe what this PR aims to solve. Include background context
that will help reviewers understand the purpose of the PR._

Issue link:#[[Link the issue
here](https://github.com/infiniflow/ragflow/issues/196)]

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
- [ ] New Feature (non-breaking change which adds functionality)
- [ ] Breaking Change (fix or feature that could cause existing
functionality not to work as expected)
- [ ] Documentation Update
- [ ] Refactoring
- [ ] Performance Improvement
- [ ] Test cases
- [ ] Python SDK impacted, Need to update PyPI
- [ ] Other (please describe):
This commit is contained in:
KevinHuSh
2024-04-02 10:51:21 +08:00
committed by GitHub
parent e3c24e653e
commit 36f2d7b797
4 changed files with 5 additions and 0 deletions

View File

@ -14,6 +14,7 @@ class HuExcelParser:
for sheetname in wb.sheetnames:
ws = wb[sheetname]
rows = list(ws.rows)
if not rows:continue
tb += f"<table><caption>{sheetname}</caption><tr>"
for t in list(rows[0]):
tb += f"<th>{t.value}</th>"
@ -38,6 +39,7 @@ class HuExcelParser:
for sheetname in wb.sheetnames:
ws = wb[sheetname]
rows = list(ws.rows)
if not rows:continue
ti = list(rows[0])
for r in list(rows[1:]):
l = []