mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-07-07 13:10:24 +02:00
skip excel files that openpyxl fails on (#4787)
This commit is contained in:
@ -360,6 +360,13 @@ def xlsx_to_text(file: IO[Any], file_name: str = "") -> str:
|
||||
else:
|
||||
logger.warning(error_str)
|
||||
return ""
|
||||
except Exception as e:
|
||||
if "File contains no valid workbook part" in str(e):
|
||||
logger.error(
|
||||
f"Failed to extract text from {file_name or 'xlsx file'}. This happens due to a bug in openpyxl. {e}"
|
||||
)
|
||||
return ""
|
||||
raise e
|
||||
|
||||
text_content = []
|
||||
for sheet in workbook.worksheets:
|
||||
|
Reference in New Issue
Block a user