From 7346ef6a2cbc61dd5b9856cb09548b94e2a19541 Mon Sep 17 00:00:00 2001 From: CaptainB Date: Wed, 4 Dec 2024 16:30:43 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=BF=87=E6=BB=A4=E7=A9=BA=E7=99=BD?= =?UTF-8?q?=E7=9A=84sheet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1049943 --user=刘瑞斌 【文档内容提取】-上传的excel中sheet为空时报错 https://www.tapd.cn/57709429/s/1625062 --- apps/common/handle/impl/table/xlsx_parse_table_handle.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/common/handle/impl/table/xlsx_parse_table_handle.py b/apps/common/handle/impl/table/xlsx_parse_table_handle.py index a98c6ae75..b92bbd345 100644 --- a/apps/common/handle/impl/table/xlsx_parse_table_handle.py +++ b/apps/common/handle/impl/table/xlsx_parse_table_handle.py @@ -90,7 +90,8 @@ class XlsxSplitHandle(BaseParseTableHandle): for sheetname in workbook.sheetnames: sheet = workbook[sheetname] if sheetname else workbook.active rows = self.fill_merged_cells(sheet, image_dict) - + if len(rows) == 0: + continue # 提取表头和内容 headers = [f"{key}" for key, value in rows[0].items()]