SSIS 循环遍历 Excel 表格 [英] SSIS Looping through Excel Sheets

查看:37
本文介绍了SSIS 循环遍历 Excel 表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 SSIS2012,我正在尝试将大约 25 个 excel 文件(每个包含大约 70 个(变量)工作表)导入 SQLserver2008.

I am using SSIS2012, I am trying to import about 25 excel files (each containing about 70(variable) sheets) into SQLserver2008.

我已经构建了它,以便它可以遍历所有 excel 表并导入第一个表,但这没有用,我如何循环所有 excel 文件并将所有表名称循环到 SQL 中?

I have built it so that it will loop through all the excel sheets and import the first sheet, but this is useless, how can I loop all the excel files and loop all of the sheet names into SQL?

我已经设置了一个脚本任务来将 sheetName 放入一个变量中,但我不知道从那里开始做什么.

I have set up a script task to get the sheetName into a variable, but I don't know what to do from there.

我的问题够清楚了吗?

我在 VB 方面比 C# 更流利,所以如果您使用脚本任务,最好粘贴 VB、net 代码.

I am much more fluent in VB over C# so if you're using script task, ideally paste VB,net code.

谢谢,詹姆斯.

推荐答案

您可以使用 Foreach 循环容器循环遍历 Excel 文件和表格

在这里,您将在控制流中使用嵌套的 foreach 循环.这些将首先遍历文件,然后遍历文件(工作表)中的表格.在循环内部,您将拥有一个带有 Excel 文件源的数据流.

Here you will use nested foreach loops in the Control Flow. These will loop first over the files, and then loop over the tables within the files (worksheets). Inside the loops you will have a Data Flow with an Excel File Source.

这篇关于SSIS 循环遍历 Excel 表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆