通常都有这样一个习惯就是按月存放我们的一些数据,一个月份一个work sheet,他们具有相同的行列组合,假设有下面这样一个Excel,每页结构如下,共有四页,每页为一个季度
那么我们需要做的是:
1. 建立一个变量:SheetName
2. 新建一个Foreach Loop Container
3. 配置这个Container
- 配置的过程中首先需要做的是选择一个ADO.NET的Enumerator
- 其次,配置connection,过程如下,并测试连接是否成功
- 选择loop 的schema为tables
4. mapping 变量,注意这里的Index为2,这个index并不是你的excel含有几个worksheet,而是指代上面所设置的schema为table
对于index的解释,可参考官方文档,这里有其中一段的截图供参考:
5. 接下来就可以添加一个data flow task了,具体配置如下
6. 下面就是导入数据了
本文参考:https://www.mssqltips.com/sqlservertip/4157/how-to-read-data-from-multiple-excel-worksheets-with-sql-server-integration-services/?utm_source=dailynewsletter&utm_medium=email&utm_content=headline&utm_campaign=20181227
但是对于index,原文未做解释