cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MWISE
Level: Powered On

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
Super User
Super User

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

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
Super User
Super User

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

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

MWISE
Level: Powered On

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

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

Helpful resources

Announcements
firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors
Users online (4,391)