Duplicate Column Name causing issues in Copy Activity

Graeme Russell 1 Reputation point
2021-10-15T18:14:27+00:00

Hi all,

I am copying csv files into a sql table with an explicit mapping ( X -> Y)

140900-image.png

It is important to me to keep the header names, if possible, as these files have a history of changing structure.

In ADF, when a column has a duplicate name, a suffix is attached of that column's ordinal position, for me:

"Agent Name" .... "Agent Name" ...

becomes

"Agent Name7" ... "Agent Name15" ...

Unfortunately, the copy activity is unable to find these columns, resulting in the following error:

ErrorCode=UserErrorInvalidColumnMappingColumnNotFound,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Column 'Agent Name7' specified in column mapping cannot be found in source data.,Source=Microsoft.DataTransfer.ClientLibrary,'

What am I doing wrong? Is ADF unable to find these automatically modified names? Am I forced to ignore column headers?

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
{count} votes

4 answers

Sort by: Most helpful
  1. SK 6 Reputation points
    2022-08-12T17:56:16.813+00:00

    Hello,
    Is there any solution to this problem ? Any updates on this solutions ? Anyone has implemented and tried this solution yet ?

    Thanks,
    SK

    1 person found this answer helpful.
    0 comments No comments

  2. SK 6 Reputation points
    2022-08-12T21:53:05.657+00:00

    HI @ SaurabhSharma-msft
    I just tried the above solution. It works fine. If you do not want to copy paste a lot of Column Names in the Destination then what you could do is that in Source Dataset select "First Row as Header" , in Source Tab of Copy activity DO NOT check "Skip Line Count" and do normal mapping first. once column names shows up then go back to Source Dataset and unselect "First Row as Header" and in Source Tab of Copy activity Select "Skip Line Count" = 1. Go back to Mapping Tab and now in the Source manually change the Column Names to Numbers 1, 2, ....
    This way you will be saving a lot of time Typing or pasting Destination Column Names.

    Hope this helps everyone who encounters Duplicate Column Name issue in Source file..

    Thanks,
    SK

    0 comments No comments

  3. Anuja Ogale 1 Reputation point
    2022-08-17T14:19:28.527+00:00

    How will this work if the source file is xlsx. Because i dont see the "skip row count". And the source file now shows two headers rows


  4. Anuja Ogale 1 Reputation point
    2022-08-17T18:27:32.253+00:00

    Here is the sample dataset: the column name DC is duplicated in the source file. I want to copy this file from my Shared drive to Datalake and would like to rename the columns as DC_Long and DC_Short.

    232098-image.png


Your answer

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