I have a SSIS 2019 Package which imports an Excel as soon as the file is placed to a folder and then moves the Excel file to another folder (agent will run it every 30 minutes). At the beginning I have a Script Task which tests if the file is in the expected folder, if true then the control flow goes to the Data Flow task, if not then it goes nowhere (process ends there). In testing the package it works fine so long as the file is in the expected folder when I open or do anything with the package. In testing when I run the package a second time, after the file has been moved, then the Control Flow doesn't go past the Script Task but I get an error from the Data Flow because in the folder a new empty file with the expected filename but incorrect sheet has been automatically created. I have no idea what task caused this or if the excel file connection manager did it at the moment the package was executed. It will even do this as soon as I open the package if the file is not in the folder. How do I stop this? I don't want it to create an empty excel file at all. I want it to just do nothing if that file is not in the designated folder.
Here's a complete sequence of events:
- Script Task checks if the file is in the folder – No: does nothing
- Yes – Executes SQL Task deletes records in Target Table One
- Then goes into Data Flow a.Excel Data Source goes into Data Conversion Task b.Then data goes into OLE DB source (Target Table One)
- Exists Data Flow – On Error sends email
- Then Executes SQL Task which – On Error sends email a. Deletes records in Target Table Two b. Inserts records into Target Table Two which do not have a null part number c.Inserts a record into a Log History Table
- Then Executes a File System Task which moves the Excel file from IMBOX folder to OUTBOX folder – On Error sends email – On Success sends email