fix: Skip password attempts for already processed Excel files
This commit is contained in:
parent
56fe322900
commit
4e1902454a
19
src/main.py
19
src/main.py
@ -56,13 +56,18 @@ def load_workbook_with_possible_passwords(filepath, passwords, keep_vba=False, d
|
|||||||
|
|
||||||
def copy_excel_file(source_path, destination_path, passwords, original_filename=None):
|
def copy_excel_file(source_path, destination_path, passwords, original_filename=None):
|
||||||
logging.info(f"Processing Excel file: {source_path}")
|
logging.info(f"Processing Excel file: {source_path}")
|
||||||
is_xlsm = source_path.lower().endswith('.xlsm')
|
|
||||||
source_wb = load_workbook_with_possible_passwords(
|
# Skip password attempts if this is already a processed file
|
||||||
filepath=source_path,
|
if os.path.basename(source_path).startswith('processed_'):
|
||||||
passwords=passwords,
|
source_wb = load_workbook(filename=source_path, keep_vba=False, data_only=False)
|
||||||
keep_vba=is_xlsm,
|
else:
|
||||||
data_only=False
|
is_xlsm = source_path.lower().endswith('.xlsm')
|
||||||
)
|
source_wb = load_workbook_with_possible_passwords(
|
||||||
|
filepath=source_path,
|
||||||
|
passwords=passwords,
|
||||||
|
keep_vba=is_xlsm,
|
||||||
|
data_only=False
|
||||||
|
)
|
||||||
|
|
||||||
dest_wb = Workbook()
|
dest_wb = Workbook()
|
||||||
if len(dest_wb.sheetnames) == 1 and dest_wb.active.title == 'Sheet':
|
if len(dest_wb.sheetnames) == 1 and dest_wb.active.title == 'Sheet':
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user