简体   繁体   English

SSIS - 创建 xlsx 文件的脚本任务(将数据从 sql 数据库导出到新的 excel 文件)

[英]SSIS - Script task to create xlsx file (Export data from sql database to new excel file)

I have data flow task, which import data from sql server to excel.我有数据流任务,它将数据从 sql 服务器导入到 excel。 Currently it requires to have excel templated in place, meaning that I have xlsx file with column names without data in my network location.目前,它需要将 excel 模板化到位,这意味着我的网络位置中有列名没有数据的 xlsx 文件。 If I run the package the excel will be filled with data.如果我运行 package excel 将充满数据。

What is needed: If I run ssis package I need new xlsx file to be created every time if package is executed.需要什么:如果我运行 ssis package 如果执行 package ,则每次都需要创建新的 xlsx 文件。 So I need to just create xlsx file with define columns every time and the xlsx file name should include date.所以我需要每次只创建带有定义列的 xlsx 文件,并且 xlsx 文件名应该包含日期。

I imagine that I have to set up script task before data flow task, which just creates xlsx file.我想我必须在数据流任务之前设置脚本任务,这只是创建 xlsx 文件。 I am not very familiar with C#, I hope that someone could share the code what to use to achieve this.我对 C# 不是很熟悉,我希望有人可以分享代码来实现这一点。

Or, you could create a folder and place a Template excel file with predefined format and no data.或者,您可以创建一个文件夹并放置一个具有预定义格式且没有数据的模板 excel 文件。

Every time the process runs, it must:每次进程运行时,它必须:

  • Copy the file using File System task to the destination location使用文件系统任务将文件复制到目标位置
  • Use Data flow task to populate the data into the file in the Destination location使用数据流任务将数据填充到目标位置的文件中
  • Rename the file in the Destination location as required根据需要重命名目标位置中的文件

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

相关问题 通过 SSIS 将数据从 Excel (xlsx) 文件加载到 SQL 表时出现科学记数法问题 - Scientific Notation Issue while loading data from Excel (xlsx) file to SQL Tables via SSIS 将数据从Excel文件导出到SQL Server数据库的最佳方法 - Best way to export data from an Excel file to SQL server database 使用SSIS将数据从多个SQL表导出到同一Excel文件中的多个工作表中 - Export data from multiple SQL tables into multiple worksheets in the same Excel file using SSIS 将数据从平面文件加载到 Sql 服务器表,并使用 SSIS 导出到 excel - Load data from flat file to Sql Server table and also export to excel using SSIS 跳过行:将数据从SSIS导出到excel文件中 - Skip rows: Export data from SSIS into excel file 将数据从数据库导出到Excel文件 - Export data from database into excel file 使用SSIS将数据导出到Excel文件 - Export data to Excel file using SSIS 如何将数据从Excel 2007 xlsx文件导入SQL Server 2000数据库? - How to import data from Excel 2007 xlsx file into SQL Server 2000 Database? 使用SSIS将Sharepoint上的xml文件中的数据导出到sql服务器 - export data from a xml file on sharepoint to sql server using ssis SSIS:使用文件上次修改日期条件将数据从excel导入到sql server数据库 - SSIS: import data from excel to sql server database with file last modified date condition
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM