I was scanning through my mails when I got this query in my inbox from one of my followers. Most of us face this issue often, so I thought of explaining it through an article. Hope this helps.
Scenario: I have an Excel file which contains records imported from SQL database “AdventureWorks”. Now I want these records exported back into another database table. Here, I am using the Excel File as a source file and Database as OLE DB destination/ SQL server Destination (any one). While loading data from excel source file to the DB destination, the SSIS package fails with following error. “[Excel Destination [43]] Error: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager “Excel Connection Manager” failed with error code 0xC0202009. There may be error messages posted before this with more information on why the AcquireConnection method call failed.”
After package fail, I am not able to open the Excel source File in the Windows Explorer as well. The Error comes out as:
“’New_Excel.xls’ cannot be accessed. The file may be corrupted, located on a server that is not responding, or read-only.”
There could be two reasons behind this problem:
- Compatibility issue between Excel Sheet and SSIS package
- Selecting only few (not all) Rows/Columns from Excel source file
Solution / Observation:
One of the main reason of the problem is the compatibility issue between the version of source excel sheet (32 bit version) and the SSIS package (64 bit version). In such cases, we need to execute our package using the 32-bit mode.
Further there could be two different scenarios depending upon how we run our package:
- If the SQL Agent Job is supposed to run the SSIS package with 32-bit excel source file and if the SQL Server version is 2008, then there should be a checkbox on the Job Step page to run the package in 32-bit mode.
- If the ETL package is still in the development phase and we are running the package using BIDS, then open the solution properties and change the “Run64BitRunTime” from “True” (default) to “False” value.
Apart from the excel file and SSIS version compatibility, the following could be the reason of the error as well.
While loading data from Excel sheet to the Database table, if we try to load only few number of fields from the source excel sheet by using ‘SQL command’ in ‘Data Access Mode’ in “Excel Source Editor”, the package run will fail. The selective load of excel source corrupts the Excel source sheet and so the loading of data to the Database fails. As a result, the excel source through error (as mentioned above) while opening even using Windows Explorer. Once the excel source is corrupted, we can’t use it even with ‘Table” or “View” option of ‘Data Access Mode’. Package will run through the same error because the excel source file is already corrupted. To use the same excel file as source for data load, we need to close and reopen the BIDS.
Observation: The excel source file cannot be used for selective data load. But there is an alternate way. We can allow all the fields of the excel source using “Table or view” and in to Database (that is easy) and then remove the records that we don’t want in our table.
By: Sumit Kumar Singh