Configure template target cells and add skip-errors mode
This commit is contained in:
1 parent
418d8336f5
commit
5f3a820641
5 files changed
+31
-17
No files matched your search
@@ -319,12 +319,13 @@ def validate_business_rules(
|
||||
|
||||
if template_path.exists():
|
||||
template_wb = load_workbook(template_path, data_only=True)
|
||||
if len(template_wb.sheetnames) != 1:
|
||||
configured_sheet = config["sheets"].get("template_source", "")
|
||||
if configured_sheet not in template_wb.sheetnames:
|
||||
issues.append(
|
||||
ValidationIssue(
|
||||
code="TEMPLATE_SHEET_COUNT",
|
||||
code="TEMPLATE_SHEET_MISSING",
|
||||
message=(
|
||||
f"Template workbook must contain exactly one sheet, found {len(template_wb.sheetnames)}."
|
||||
f"Configured template sheet '{configured_sheet}' not found in template workbook."
|
||||
),
|
||||
severity="error",
|
||||
)
|
||||
|
||||
@@ -67,7 +67,11 @@ def build_employee_workbooks(
|
||||
|
||||
for employee_name, assignments in assignments_by_employee.items():
|
||||
workbook = load_workbook(template_path)
|
||||
base_sheet = workbook.worksheets[0]
|
||||
template_sheet_name = config["sheets"].get("template_source", "")
|
||||
if template_sheet_name and template_sheet_name in workbook.sheetnames:
|
||||
base_sheet = workbook[template_sheet_name]
|
||||
else:
|
||||
base_sheet = workbook.worksheets[0]
|
||||
|
||||
for index, assignment in enumerate(assignments, start=1):
|
||||
if index == 1:
|
||||
|
||||
Reference in new issue
Block a user