在SSIS 2012中通过Excel文件循环的问题(Foreach ETL)

我正在尝试处理本地计算机上目录中的Excel文件(2007 .XLSX)。 我已经列出了一些问题。 在此之前,让我解释一下我想做什么,以及我如何设置和所有我迄今为止的尝试。

build立

  • Microsoft Visual Studio 2012
  • 微软Windows 7(32位)

目标

创build一个简单的ETL来遍历文件夹中的Excel文件,并将数据加载到SQL服务器表中。

目前的尝试

注意:我对编程和特别是循环非常熟悉,但是在SSIS中,我正努力从甚至读取Excel文件。

我已经尝试过,正在做以下工作:

  • 创build一个包
  • 创build了一个FOREACH循环容器任务

FOREACH循环任务

  • 设置为Foreach文件枚举器
  • expression式将Directory指定给具有目录值('C:\ Users \ Me \ Desktop \ Excels \')的variables
  • 在variables映射下,我在索引0处指定了一个variables
  • 设置为使用文件和扩展名
  • 目前,我正在查看所有文件( )注:我已经使用监视debugging来确定variables是否填充。 现在,我已经尝试了一个expression式任务来构build完整的path,然后再转移到数据stream以及仅使用分配的两个variables。

数据stream(在FOREACH循环容器之后)

  • 设置Excel文件源
  • 设置OLE DB目标

Excel来源(在数据stream中作为第一个任务)

  • 最初使用其中一个文件设置列(显示预览和input/输出)注:数据显示,因此连接看起来很好

Excel源连接pipe理器

  • DELAY VALIDATION = TRUE
  • EXPRESSIONS = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + @[User::excelFullPath] + "Extended Properties='EXCEL 12.0 XML;HDR=YES';"
  • ExcelFilePath = @[User::excelFullPath]
  • FirstRowHasColumnName = TRUE

注:我已经尝试了使用连接string和Excel文件path属性的组合。 我已经自己尝试过了。

注意:我目前在文件夹中有两个Excel文件。 它们与不同的文件名是相同的,列是相同的。

收到错误

运行时的最新错误是:

 SSIS package "C:\Users\biadmin\Desktop\0006AssocImport\0006AssocImport\Package.dtsx" starting. Information: 0x4004300A at Data Flow Task, SSIS.Pipeline: Validation phase is beginning. Error: 0xC0202009 at Data Flow Task, Excel Source 1 [2]: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E37. Error: 0xC02020E8 at Data Flow Task, Excel Source 1 [2]: Opening a rowset for "MAIN$" failed. Check that the object exists in the database. Error: 0xC004706B at Data Flow Task, SSIS.Pipeline: "Excel Source 1" failed validation and returned validation status "VS_ISBROKEN". Error: 0xC004700C at Data Flow Task, SSIS.Pipeline: One or more component failed validation. 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 raised (6) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors. Warning: 0x80019002 at Package: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The Execution method succeeded, but the number of errors raised (6) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors. SSIS package "C:\Users\biadmin\Desktop\0006AssocImport\0006AssocImport\Package.dtsx" finished: Failure. The program '[6272] DtsDebugHost.exe: DTS' has exited with code 0 (0x0). 

之前收到另一个错误

 SSIS package "C:\Users\biadmin\Desktop\0006AssocImport\0006AssocImport\Package.dtsx" starting. Information: 0x4004300A at Import RAW Excel Data, SSIS.Pipeline: Validation phase is beginning. Error: 0xC0202009 at Package, Connection manager "Excel Connection Manager": SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft Access Database Engine" Hresult: 0x80004005 Description: "Could not find installable ISAM.". Error: 0xC020801C at Import RAW Excel Data, Excel Source [2]: 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. Error: 0xC0047017 at Import RAW Excel Data, SSIS.Pipeline: Excel Source failed validation and returned error code 0xC020801C. Error: 0xC004700C at Import RAW Excel Data, SSIS.Pipeline: One or more component failed validation. Error: 0xC0024107 at Import RAW Excel Data: 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 raised (5) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors. Warning: 0x80019002 at Package: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The Execution method succeeded, but the number of errors raised (5) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors. SSIS package "C:\Users\biadmin\Desktop\0006AssocImport\0006AssocImport\Package.dtsx" finished: Failure. 

这些并不是所有收到的错误(我没有logging所有这些错误),但目前它只是在一个特定的错误一次失败。

注意

我看过不lessYouTube教程,并阅读了一些简要的步骤。 在看到数据stream任务之前,我已经看到了一个从脚本任务设置连接pipe理器的地方。 我看到一个ConnectionString属性只被设置为保存Excel文件path的variables。

问题

  1. 我在设置中错过了什么
  2. 在configuration连接pipe理器查看文件的variables之后,仍然有configurationExcel Source任务的input和输出的function,因为此时它显示错误
  3. 在这种情况下,我更喜欢在configuration框中看到列映射(Script或Flow),SSIS中的开发人员首选项是什么?