Want to write a data from array variable to csv file in adf

Amar Agnihotri 891 Reputation points
2022-06-28T05:27:22.89+00:00

Hi,
I want to write a data from array variable to csv file in adf pipeline.

Here is my pipeline
215587-image.png

As a result of until activity i have all the data stored to an array variable

215549-image.png

Now i want to store this data to csv file using copy activity.
Can anyone help me out in this. @Suba Balaji

Thanks

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,663 questions
0 comments No comments
{count} votes

Accepted answer
  1. Suba Balaji 11,186 Reputation points
    2022-06-28T05:41:42.41+00:00

    Hi @Amar Agnihotri ,

    Point your source data set to a file in blob or data lake. The file can be any file. With one or two columns and couple of rows (this is just a dummy file)

    Then add an additional column in copy source and point to your variable Data. (You may have to convert the array variable to string using join)

    @fr (Variables ('Data'),',')

    This will convert the whole array to a string separated by comma and assign the string value to the additional column.

    Then , Under mapping tab, remove the columns from dummy source file and just keep the additional column.

    Point the sink to a file or folder.

    That's all. Please give a try and let us know.

    Thanks.

    1 person found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Nandan Hegde 29,896 Reputation points MVP
    2022-06-28T05:48:40.78+00:00

    Hey,
    The below URL provides detailed steps :
    stackoverflow.com/questions/60673220/transfer-the-output-of-set-variable-activity-into-a-json-file-azure-data-fact

    But one change would be to convert the array to string

    1 person found this answer helpful.
    0 comments No comments

  2. Sara Samy Khalil Shabana 1 Reputation point
    2022-06-28T22:49:50.193+00:00

    Thanks for the reply. Actually it has been achieved

    0 comments No comments