Fix: parsing excel with chartsheet & Clamp begin to a minimum of 0 to prevent negative indexing (#10819)

### What problem does this PR solve?

Fix: parsing excel with chartsheet #10815

Fix: Clamp begin to a minimum of 0 to prevent negative indexing #10804
### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Billy Bao
2025-10-28 09:40:37 +08:00
committed by GitHub
parent 850e119a81
commit e59458c36b
3 changed files with 27 additions and 6 deletions

View File

@ -15,6 +15,7 @@
#
import copy
import logging
import re
from io import BytesIO
from xpinyin import Pinyin
@ -44,7 +45,11 @@ class Excel(ExcelParser):
rn = 0
for sheetname in wb.sheetnames:
ws = wb[sheetname]
rows = list(ws.rows)
try:
rows = list(ws.rows)
except Exception as e:
logging.warning(f"Skip sheet '{sheetname}' due to rows access error: {e}")
continue
if not rows:
continue
headers, header_rows = self._parse_headers(ws, rows)