识别 SSIS 中的 Excel 文件路径

Identifying Excel filepath in SSIS

我正在使用 this ForEach loop tutorial 尝试通过 SSIS 将我的所有 Excel 文件从文件夹导入到 SQL table。我完全按照这些步骤操作,但无法让 Excel 源代码块识别变量文件名。我得到的错误表明文件路径根本不起作用:

Could not retrieve the table information for the connection manager ConnectionManagerName

源文件格式、类型、文件夹一致。有没有其他人有这个问题?我怀疑我在 link 中的步骤 2-4 之间遗漏了一些东西,但我不知道它是什么。

我解决了!我在步骤 3b 中使用了 ConnectionString 而不是 ExcelFileName。对于阅读此答案的任何人,确切的 ConnectionString 格式会有所不同 (see here),但会类似于

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\myFolder\myExcel2007file.xlsx;
Extended Properties="Excel 12.0 Xml;HDR=YES";