The Excel file at the end of the SSIS export date, And the excel file at the end of the ssis Export

Source: Internet
Author: User
Tags ssis

The Excel file at the end of the SSIS export date, And the excel file at the end of the ssis Export

When you use the ETL Tool to regularly export data documents in Excel format, it is sometimes required that the exported file name end with the date or time of the day for distinguishing or archiving.

Microsoft's SSIS can also meet these requirements, with two key points:

1. Use Variable to set the Excel file name

2. Use Execute SQL Task to pre-set the WorkSheet in the Excel file (similar to the table creation method)

The implementation process is as follows:

 

 

 

Set the Excel Connection Manager attribute ExcelFilePath to the User-Defined Variable.

 

User-Defined Variable: FilePath. The formula is as follows:

 

The preceding steps show that the exported Excel file name ends with the date of the day. However, because the file is dynamically generated, it is not created in advance, therefore, the data stream does not know where the field is mapped during running.

Therefore, you also need to create a "Table" in Excel. Its structure matches the field ing. Execute SQL Task is used here. Generally, this control runs in the context of Database, but set its ConnectionType to Excel, and then use the Create table statement to Create a WorkSheet structure in the file corresponding to the Excel Connection Manager.

 

 

 

 

The running result is as follows:

 

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.