fix: Improve chartsheet warning to show original filename

This commit is contained in:
Bobby Abellana (aider) 2025-02-18 09:30:42 -08:00
parent f9b982dd02
commit 5031f9a0e6

View File

@ -75,7 +75,10 @@ def copy_excel_file(source_path, destination_path, passwords):
# Create new sheet in destination workbook
from openpyxl.chartsheet import Chartsheet
if isinstance(source_sheet, Chartsheet):
chartsheet_warning = f"Chartsheet detected in '{os.path.basename(source_path)}' on sheet '{sheet_name}'."
original_filename = os.path.basename(source_path)
if '_processed' in original_filename: # If it's a temp file, get original name
original_filename = original_filename.split('_processed')[0]
chartsheet_warning = f"Chartsheet detected in '{original_filename}' on sheet '{sheet_name}'."
# For chartsheets, we need to create a worksheet instead
dest_sheet = dest_wb.create_sheet(title=sheet_name)