Azure Logic Apps-How To Export SQL Data into HTML

This article shows how logic apps can be used to show a SQL data in a HTML table.

Tech Zero

--

Image credit — https://www.captivateiq.com/blog/export-payout-data-with-customizable-templates

👉 Test Setup

In my Azure SQL Database, I created a table called medium_tbl. The data from this table is shown below:

Through the steps mentioned below, I will copy this data out of Azure DB and paste it into a HTML table. The HTML table can then be sent to any recipient through an email or posted in a Teams group or can serve any other use case one might have.

Step 1: Set Trigger And Get Data From Azure Database

Logic app-Get rows from SQL table
(Logic app-Get rows from SQL table)

In the above screenshots, I put the schedule for every day. Next, I connected logic apps to my Azure Database and located the table whose data needs to be retrieved.
If I click ‘Add new parameter’, I can see that there are other options to help me filter out the data that is being retrieved. For this article, I would extract everything out of the table.

Step 2: Create a JSON Message From SQL Data

Logic app-Use Compose action
(Logic app-Use Compose action)

In this step, I will use Compose action that will help me create a single message in JSON format from the SQL table data. If we run the logic app pipeline until here, we can see that the SQL rows will be presented in a JSON array.

Step 3: Parse JSON Message

Logic app-Parse a JSON array
(Logic app-Parse a JSON array)

The JSON message created above will now be parsed using Parse JSON action. This action helps us to more easily use the properties from the dynamic content list. The properties we are interested in are: first_name, last_name and article_name.

--

--

Tech Zero

Data Engineering Manager | Azure, Databricks and Snowflake stack | Here to share my knowledge with everyone