I have this case where we have different queries we want to run in SQL Server then save it in an Excel file. I parameterized the Excel dataset I have then assigned it in the "Sheet name" property but I noticed when using Copy Data Activity the Sink property is not showing any datasets with Excel only CSV Datasets.
I’ve been looking for work around on this but I’m only seeing parts in the net that reads the Excel file with multiple sheets then iterate those with For Each. But what I need is vice versa. I want to write into a single Excel file the different results of my 3 queries in each different sheets using ADF.
Example:
FileName: Results.xlsx
SELECT * FROM Table1
Insert in Results.xlsv
in sheet named Result1
.
SELECT * FROM Table2
Insert in Results.xlsv
in sheet named Result2
.
SELECT * FROM Table3
Insert in Results.xlsv
in sheet named Result3
.
2
Answers
Unfortunately ADF doesn’t support Excel file as a sink till now.
For your above use case, you would have to write your own custom logic in Azure functions, Databricks or Azure batch etc.
As called out by Nandan , Excel is currently not supported as sink in ADF . I see that you have added to sql server tag and so I am assuming that you are using on-premise server , if thats the case you can use a simple powershell script . I have shared a fairly but working powershell script .below