简体   繁体   English

使用SSIS将多个Excel文件导入表

[英]Import Multiple Excel files into a table using SSIS

I have two Excel files named 'First' and 'Second' in same location . 我在同一位置有两个名为“ First”和“ Second”的Excel文件。 在此处输入图片说明

They have same schema. 它们具有相同的架构。

在此处输入图片说明

I used foreach loop counter and put Data flow task into it. 我使用了foreach循环计数器,并将数据流任务放入其中。

在此处输入图片说明

The data flow diagram looks like this:- 数据流程图如下所示:-

在此处输入图片说明

Here, I selected first excel file as the source.... 在这里,我选择了第一个excel文件作为源。

My For Each Loop Container Editor:- 我的每个循环容器编辑器:

在此处输入图片说明

After running the SSIS package successfully the output came like this:- 成功运行SSIS包后,输出如下:-

在此处输入图片说明

Which took data only from First excel file and three times,I must have done something wrong in there,But I cant figure it out. 该文件仅从First excel文件中获取了数据,并且有3次,我肯定在那里做错了,但是我无法弄清楚。

Check your Foreach Loop Editor: 检查您的Foreach循环编辑器:

Collection>Folder
Collection>Files

Your file should not have a particular file name, for multiple excel use *.xlsx . 您的文件不应具有特定的文件名,因为多个excel请使用*.xlsx

Edit: 编辑:

Use a Script task to Debug. 使用脚本任务进行调试。 Map the value of ForEach to a variable and display it through Script task. 将ForEach的值映射到变量,然后通过脚本任务显示它。 Edit the script task with below code. 使用以下代码编辑脚本任务。

MessageBox.Show(Dts.Variables["Variable"].Value.ToString());

Also, Please check your Source Excel connetion is configured correctly with values coming from foreach. 另外,请检查您的Source Excel connetion是否正确配置了来自foreach的值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用SSIS包将多个Excel文件导入SQL Server 2008 R2? - Import multiple Excel files into SQL Server 2008 R2 using SSIS Packages? 是否有一种简单的方法,可以使用SSIS将多个Excel文件中的数据导入SQL,包括文件名? - Is there a simple method to import data from multiple excel flies to SQL including names of the files using SSIS? 使用 BCP 将多个 Excel 文件导入到 SQL 中创建的表中 - Import multiple Excel Files using BCP into a created Table in SQL 如何使用SSIS将Excel来源中的多个Excel工作表导入SQL? - How to import multiple excel sheets in an excel source to SQL using SSIS? 将多个Excel文件/工作表导入SQL表 - Import multiple Excel files/sheets into SQL Table 如何将数据从SQL表导出到SSIS中的多个excel文件? - How to export data from SQL table to multiple excel files in SSIS? 如何使用 SQL 与查询合并多个 excel 文件而不使用 SSIS? - How to merge multiple excel files using SQL with a query and not using SSIS? 如何使用SSIS将具有不同标头的多个csv文件导入数据库? - How to import multiple csv files with different headers into database using SSIS? 从Excel文件批量导入SSIS - SSIS bulk import from excel files SSIS 导入具有多个 header 行的 excel 文件 - SSIS import an excel file with multiple header rows
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM