Excel file with multiple row of column headers, want to make it one column header using azure data factory

Khimlal, Tulsi 20 Reputation points
2024-02-21T05:29:13.7466667+00:00

Hi, I have an Excel file used as a data source in Data Factory, where I encountered a challenge with multiple rows for column headers (Nested headers). Specifically, I aim to consolidate two rows into a single row to streamline the header columns. To provide a clearer understanding, consider the following example: User's image

By merging these rows, I aim to make like this.

project1 test1

project1 test2

project1 test3

project2 test4

project2 test5

project2 test6

Guidance on how to efficiently accomplish this task within Data Factory would be helpful.

Excel
Excel
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
1,905 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
10,708 questions
{count} votes

1 answer

Sort by: Most helpful
  1. AnnuKumari-MSFT 32,906 Reputation points Microsoft Employee
    2024-02-28T09:28:00.75+00:00

    Hi Khimlal, Tulsi ,

    Thankyou for using Microsoft Q&A platform and thanks for posting your query here.

    As per my understanding you are trying to merge rows having header in excel into single header . However , it is not just one step process , we need to perform data transformation on the source dataset. Additionally, in your scenario , test1,test2, and test3 needs to be converted to project1 test1, project1 test2, project1 test3 and the next set of columns : test4,test5 and test6 to be converted to project2 test4, project2 test5 and project2test .

    • Add Source transformation and point the dataset to the source excel file. Remove 'First row as header'
    • Add Filter transformation and provide this expression: !startsWith({_col0_},'Project')
    • Add derived column transformation and add column pattern to replace test1 with project1 test1 and so on with other
      User's image
    • Add sink transformation and in dataset select 'first row as header'

    Hope it helps. Kindly accept the answer by clicking on Accept answer button. Thankyou


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.