3
votes

I want to send multiple rows of a single SQL query in single mail using Azure logic apps. I tried but I am getting mail for each row. Is there any way to achieve this? Help me out to find a solution.

Example query:

Select * from TestTable; --it has 5 rows for example.

So, I want to send these 5 rows in a single mail using azure logic apps. If we can send this in excel file it would be even better. Thanks in advance!

1
could you please share what you have tried before ? I guess you can create an email and add an attachment. you just convert your select result to csv and add it as an attachment ?? - Thomas
Hi, Joey Cai answered what I was looking for. Pls. Refer below - Selvi.P

1 Answers

2
votes

I want to send these 5 rows in a single mail using azure logic apps.

You could use Expression with body('Execute_a_SQL_query')?['resultsets']?['Table1'] in email body which will list the query result in single email.

Designer:

enter image description here

Output:

enter image description here

If we can send this in excel file it would be even better.

If you want to send the query result as a excel file and send email, you could add a Create CSV table connector, and add the file as attachment when sending email.

Designer:

enter image description here

Output:

enter image description here