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
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Top Solution Authors
Users online (1,759)