简体   繁体   English

如何转换xlsx文件中的数据,以删除单元格中的合并并使用SSIS将某些列转置为在SQL Server中接收数据?

[英]How can I transform data in xlsx file removing merge in cells and transposing some columns to ingest data in SQL Server using SSIS?

I have an As-Is spreadsheet data source with merge applied in some columns and for weekly data columns are used in incremental format, eg for the 2019W12 the next column will be populated (R column). 我有一个按原样制作的电子表格数据源,在某些列中应用了合并,并且每周数据列以增量格式使用,例如,对于2019W12,将填充下一列(R列)。

As-Is Spreadsheet Data Source 电子表格数据源

电子表格数据源

I need parse the spreadsheet content and load into SQL Server table using SSIS and proposed format is: 我需要解析电子表格内容并使用SSIS加载到SQL Server表中,建议的格式为:

Proposed Spreadsheet Data Transformation 拟议的电子表格数据转换

拟议的电子表格数据转换

I've tried some alternatives such as apply transformation in SSIS, but column increment case exception in next week load job, I tried to parse and split spreadsheet data with Python (xlrd) but without success to transpose and associate data from columns F to 'N' with columns from A to E. Does anybody faced this type of problem to ingest spreadsheet data using SSIS into SQL Server or have another logical way to transform data before ingestion? 我尝试了一些替代方法,例如在SSIS中应用转换,但是在下周的加载作业中出现了列增量案例异常,我尝试使用Python(xlrd)解析和拆分电子表格数据,但未成功将数据从F列转置和关联到' N',列从A到E。有人会遇到这种类型的问题,即使用SSIS将电子表格数据摄取到SQL Server中吗,还是有另一种逻辑方式在摄取之前转换数据?

Splitting Question into sub tasks 将问题拆分为子任务

Based on your question there are three main functionalities that you are looking to achieve: 根据您的问题,您希望实现三个主要功能:

  1. Finding an efficient way to manipulate Excel files 寻找一种有效的方式来处理Excel文件
  2. Unmerge Cells and fill duplicates values 取消合并单元格并填充重复值
  3. Transpose Rows into Columns 将行转置为列

Possible solution 可能的解决方案

In order to perform a complex transformation you have to do this using one of the following approaches because provides all functionalities that can be done in Microsoft Excel: 为了执行复杂的转换,您必须使用以下方法之一来执行此操作,因为它提供了可以在Microsoft Excel中完成的所有功能:

  1. .Net Microsoft.Office.Interop.Excel library (C# or VB.NET) .Net Microsoft.Office.Interop.Excel库(C#或VB.NET)
  2. Excel VBA Excel VBA

The solution you are looking for is complex and very specific to the issue, you have to implement the logic at your own. 您正在寻找的解决方案非常复杂,并且非常针对该问题,因此您必须自己实现逻辑。 I will provide some links that can helps you to achieve that: 我将提供一些链接来帮助您实现这一目标:

Helpful Links 有用的网址

Unmerge Cells and fill duplicates values 取消合并单元格并填充重复值

Manipulating Excel files using C# 使用C#处理Excel文件

Transpose Excel Rows 转置Excel行

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

相关问题 转置SQL Server中的列并删除不需要的列? - Transposing the column in SQL server and removing unwanted columns? 如何将SQL Server行数据转换为列? - How to transform SQL Server row data to columns? SQL Server导入具有合并单元格的Excel数据 - sql server importing excel data with merge cells 如何将表列转换为Sql server表中的垂直数据? - How to transform the table columns to vertical data in Sql server tables? 如何使用DNN在SQL Server表上直接加载XLS或XLSX数据文件 - How to load XLS or XLSX data file directly on a SQL Server table using DNN 使用SSIS将Sharepoint上的xml文件中的数据导出到sql服务器 - export data from a xml file on sharepoint to sql server using ssis 如何使用sql server 2008安全销毁某些数据? (使用DoD安全擦拭或类似方法) - How can I securely destroy some data using sql server 2008 ? (using DoD secure wipe or an equivalent) 如何将 sql 服务器查询结果导出到 .csv 文件,数据在导出文件中应使用双引号 SSIS - How to export the sql server query result to .csv file and data should be double quotes in exported file using SSIS 将数据转换为多列 - Transposing data into multiple columns 使用SQL Server UNION ALL时,可以合并列吗? - When using SQL Server UNION ALL, can I merge columns?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM