cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MWISE
Advocate I
Advocate I

Create a Flow: Pull records from Azure SQL to CSV or Excel

Hello,

 

I have a project where I need to create a Flow that will pull the records from an Azure SQL db to a CSV or Excel file. We have mulitiple tables so if I need to create any queries I'll work with my BI team to create them. I just need a starting place for getting the flow created.

 

We may want both scheduled and a button trigger, so I assume I would create two different flows?

 

FYI... The project starts with a PowerApp where a salesperson enters forecast data each month and that gets stored in Azure. We need the flow to pull the data for all salespeople by region to send to the Planner. Phase 2 of the project may look at using a PowerApp for the planner but it's a lot of data to process so we're not sure yet.

 

Thank you.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @MWISE based on what I've read the following Flow should get you started. I haven't got a SQL database to connect to in order to provide more context to my screenshots, but the basic steps should get you going.

 

As you have two different starting triggers, you will need two different Flows. There are patterns that you can employ to be able to reuse Flows, but I'd start simple and once you have nailed your process then consider consolidating the logic.

 

The following Flow is based on a Flow Button manual trigger, although you could use a PowerApps instant trigger too if you wanted.

 

The first action will execute a SQL statement against a given database. There are alternative actions such as execute stored procedure which you could also employ to get your data from your database table.

 

I have then used an "Add new row to table" action for Excel in order to write the items from the database to Excel.

 

When I start taking dynamic content from the SQL action and adding to the Excel action, I would be expecting a loop to appear. This is perfectly normal as it will just loop through all of the items which have been retrieved from your SQL query.

 

Again, apologies that I can't give you something more concrete, but if you get stuck I'll go and run myself up an Azure SQL DB.

 

SQL.PNG





Did my reply help? Please give it a thumbs up.
Did I answer your question? Please mark my post as a solution!
If you liked my response, please consider giving it a thumbs up. THANKS!


Proud to be a Flownaut!





Community Leader: Black Country PowerApps & Flow User Group

View solution in original post

2 REPLIES 2

Hi @MWISE based on what I've read the following Flow should get you started. I haven't got a SQL database to connect to in order to provide more context to my screenshots, but the basic steps should get you going.

 

As you have two different starting triggers, you will need two different Flows. There are patterns that you can employ to be able to reuse Flows, but I'd start simple and once you have nailed your process then consider consolidating the logic.

 

The following Flow is based on a Flow Button manual trigger, although you could use a PowerApps instant trigger too if you wanted.

 

The first action will execute a SQL statement against a given database. There are alternative actions such as execute stored procedure which you could also employ to get your data from your database table.

 

I have then used an "Add new row to table" action for Excel in order to write the items from the database to Excel.

 

When I start taking dynamic content from the SQL action and adding to the Excel action, I would be expecting a loop to appear. This is perfectly normal as it will just loop through all of the items which have been retrieved from your SQL query.

 

Again, apologies that I can't give you something more concrete, but if you get stuck I'll go and run myself up an Azure SQL DB.

 

SQL.PNG





Did my reply help? Please give it a thumbs up.
Did I answer your question? Please mark my post as a solution!
If you liked my response, please consider giving it a thumbs up. THANKS!


Proud to be a Flownaut!





Community Leader: Black Country PowerApps & Flow User Group

View solution in original post

@MattWeston365 I finally got live data to test this with and it worked great! Thanks for your help!

Helpful resources

Announcements
User Groups Public Preview

Join us for our User Group Public Preview!

Power Automate User Groups are coming! Make sure you’re among the first to know when user groups go live for public preview.

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Users online (55,364)