// Hook: BeforeProcessing // Halt the job if a required source file is missing. // // BeforeProcessing runs before any workbook is opened, so it's a great place // to check that everything the job depends on is in place. AddError stops the // job immediately with a clear message in the job history. using System.IO; var requiredFile = @"\\fileserver\reports\source_data.xlsx"; if (!File.Exists(requiredFile)) { AddError($"Required source file is missing: {requiredFile}. Please ensure the file is in place before running this job."); } Logger.LogInformation($"Pre-flight file check passed for '{JobName}'.");