Skip to content

Commit ad2962d

Browse files
committed
Prevent showing no default style warning
* warn("Workbook contains no default style, apply openpyxl's default") Signed-off-by: Chin Yeung Li <[email protected]>
1 parent cce1580 commit ad2962d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/attributecode/util.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,11 @@ def load_excel(location):
675675
"""
676676
results = []
677677
errors = []
678-
sheet_obj = openpyxl.load_workbook(location).active
678+
import warnings
679+
680+
# This is to prevent showing the: warn("Workbook contains no default style, apply openpyxl's default")
681+
with warnings.catch_warnings(record=True):
682+
sheet_obj = openpyxl.load_workbook(location).active
679683
max_col = sheet_obj.max_column
680684

681685
index = 1

0 commit comments

Comments
 (0)