Power Automate Desktop (RPA) retrieve data from database

Power Automate Desktop (RPA) retrieve data from database

Power Automate Desktop

This blog article shows you how to extract the data from SQL Server database and write to Excel Workbook. To simulate this flow, you need to have SQL Server installed also Microsoft Excel.

Start Power Automate Desktop. Add New flow, give any name to the flow. Expand Database Actions. Drag the Open SQL connection to the flow.

Click the icon (the grey color) to configure the connection. I am using localhost and Northwind database. Click OK.

Click Save when the connection string is built.

Drag the Execute SQL statement to the flow after the Open SQL connection Acton. If you already have the flow then click on the 3 vertical dots on the right then select Edit.

Get the %SQLConnection% variable that is created by the Open SQL connection Action. In the SQL statement I typed SELECT ProductName, UnitPrice from Products to extract the ProductName and UnitPrice columns from the Products table. Click Save.

Drag Close SQL connection to the flow. Select %SqlConnection%. Click Save.

Expand Excel under Actions. Select with a blank document. Click Save.

Drag Write to Excel worksheet to the flow. Select %ExcelInstance% as Excel instance. Select %QueryResult% for the Value to write. Select On specified cell for Write mode. Column put 1 and Row put 1. Click Save.

Drag Close Excel to the flow. Select %ExcelInstance% as Excel instance. Select Save document as for Before closing Excel. Put the path for Document path. Click Save.

Run the Flow you will get the below output.


Power Automate Desktop (RPA) retrieve data from database

Muddy water is best cleared by leaving it alone.

May 25, 2023

0
0

Comments

+

© 2024 Inc. All rights reserved. mulikevs