failed to import excel to sql server using ssis pa

2019-09-20 01:33发布

Hi im developping an ssis package that imports excel files (.xlsx) from an ftp server to a local folder then they are imported to a sql server table . I'm using a foreach mapping to the name of files. The import from the ftp server to local work fine, but the import from the local folder to the sql table failed.

It seems that I have a problem in excel source. These are the errors:

Start SSIS package "Package.dtsx."
Information: 0x1 at Script Task, C # My Message: System.Collections.ArrayList
Information: 0x4004300A at Data Flow Task, SSIS.Pipeline: Validation phase begins.
Error: 0xC0202009 at Data Flow Task, Excel Source [1]: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E37.
Error: 0xC02020E8 to Flow Task data, Excel Source [1]: Failed to open a rowset for "Sheet1 $". Verify that the object exists in the database.
Error: 0xC004706B to Flow Task data SSIS.Pipeline: validation failed "component" Excel Source "(1)". Returned validation status "VS_ISBROKEN."
Error: 0xC004700C to Flow Task data SSIS.Pipeline: Failed to validate one or more components.
Error: 0xC0024107 at Data Flow Task: There were errors during task validation.
Warning: 0x80019002 at Foreach Loop Container: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The Execution method succeeded, but the number of errors (6) reached the maximum allowed (1); leading to a failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the value of MaximumErrorCount or fix the errors.
SSIS package "Package.dtsx" finished: Success.
The program '[5504] Package.dtsx: DTS' has exited with code 0 (0x0).

As configuration I have:

For the excel manager connexion, I made an expression for connectionString = @[User::variable1] + @[User::DOWNLOAD_DIRECTORY_LOCAL] + @[User::FTP_FILE_URL] + @[User::variable2]

variable 1 =Provider=Microsoft.ACE.OLEDB.12.0;Data Source=

variable 2 = ;Extended Properties="EXCEL 12.0;HDR=YES";

I made also the delay validation property to true for data flow task, ftp task, foreach task and excel connection.

2条回答
对你真心纯属浪费
2楼-- · 2019-09-20 01:57

The question you should ask yourself when having this issue is:
Where do I run my dstx file from ?
Is it from Microsoft Visual Studio ?
Is it from a SQL Agent ?
Is it from the Integration Services Package Execution Utiliy ?
Then refine your question to find the answer on the forums.

查看更多
我想做一个坏孩纸
3楼-- · 2019-09-20 02:03

I just wrote a package to do the very same thing myself. Things to check in this order:

  1. in your Excel Data Connection have you browsed to the excel files in your local folder (once they are there) and selected one (you need to copy one in there while developing)? so when you go to your excel source object inside your Data Flow Task (inside the For Each) you can select the Excel Data Connection and then see Sheet$1 under "name of the excel sheet"?

  2. Once you are sure you have done above have you then right-clicked on the Excel Data Connection and in the Expressions property added ExcelFilePath = @[User::FTP_FILE_URL]? (note you need to select 'Fully Qualified' under Retrieve File Name on the Collection tab of the For Each container)

  3. in your Excel Data Connection have you selected the right version (Excel 2007) for the .xlsx files or Excel 2003 for .xls? I noticed a small bug where when I changed the filename it defaulted back to 2007, I had to manually change it back (again) to 2003.

  4. Check at least one workbook exists in the folder before the step runs. There is some code around here about how to add a script task to validate at least one file being in User::DOWNLOAD_DIRECTORY_LOCAL.

  5. I got a load of errors about the driver for Microsoft.ACE.OLEDB.12.0, plus had issues with a 64-bit server and had to wrap the package in a job and check the 'use 32-bit runtime' option under execution options in the job properties. Check the driver is working OK (although it usually gives a specific driver error if you haven't got it set up right).

Um that's it offhand just quickly before I head home. Let me know if it works or is still a fail..

查看更多
登录 后发表回答