How to Update an Excel File in SharePoint with Power Automate Desktop
Question details
The user needs to run an on-premises SQL query and automatically write the results to an existing Excel workbook stored in a SharePoint library using Power Automate Desktop.

- Product
- Microsoft Excel, Power Automate Desktop
- Device & OS
- not provided
- Scenario
- Automating data export from an on-premises SQL server to a SharePoint-hosted Excel file for centralized data tracking and reporting.
- Observed behavior
- Power Automate Desktop natively handles local Excel files, but requires different approaches or community workarounds to successfully target and update SharePoint-hosted Excel files.
Ensure you have the necessary permissions to access the target SharePoint document library and that an On-Premises Data Gateway is configured if you need to query local SQL databases.
Use Power Automate Cloud Flows (Recommended)
Since Power Automate Desktop is optimized for local automation, the most reliable way to update SharePoint-hosted workbooks is by using a Cloud Flow with the Excel Online (Business) connector.
Cloud flows natively integrate with SharePoint and Excel Online, making them much better suited for querying on-premises data (via a gateway) and writing it directly to a SharePoint document without relying on desktop UI automation.
Log into Power Automate in your web browser and create a new Automated or Scheduled Cloud Flow.
Add the 'SQL Server' action, select 'Get rows' or 'Execute a SQL query', and connect to your on-premises database using your pre-configured data gateway.
Add the 'Add a row into a table' action under the 'Excel Online (Business)' connector.
Select your SharePoint Site, Document Library, the specific Excel file, and the Table name where the SQL data should be inserted. Map the SQL columns to the Excel table columns.

Sync SharePoint to a Local Drive for Desktop Automation
If you must strictly use Power Automate Desktop (PAD), you can sync the SharePoint library to your local machine so PAD can treat it as a local Excel file.
Consult the Power Automate Community for Custom Scripts
For highly specific scenarios involving direct API calls from PAD to SharePoint, the Microsoft Power Automate Community offers custom scripts and workarounds.
Easily Edit and Manage Spreadsheets with WPS Office
If you are managing complex data exports or simply looking for a cost-effective, high-performance suite for your spreadsheet tasks, WPS Office is a perfect choice. It provides powerful data processing capabilities with a familiar interface, helping you work seamlessly outside of automated flows.
- 1. Download and Install: Visit the official WPS website to download WPS Office Free and complete the quick installation process.
- 2. Open Your Workbooks: Launch WPS Spreadsheets and open any existing Excel files you exported from your SQL databases.
- 3. Analyze and Edit: Use the advanced formulas, pivot tables, and charting tools to analyze your data effortlessly.

Frequently Asked Questions
Can Power Automate Desktop edit Excel files on SharePoint without syncing?
Power Automate Desktop is primarily designed for local automation. To directly interact with an Excel file on SharePoint without syncing it locally via OneDrive, it is highly recommended to use Power Automate Cloud flows utilizing the Excel Online (Business) connector.
Why does my flow fail to find the Excel table in SharePoint?
For Power Automate to write or read data dynamically from an Excel file in SharePoint, the target range must be formatted as an official Table. You can do this by opening the workbook, highlighting your data, and pressing Ctrl+T before running your flow.
How do I export SQL server data to Excel using Power Automate?
You can connect to your on-premises SQL server using an On-Premises Data Gateway. Use the 'Get rows' action in a Cloud flow to pull the data, then use a 'Apply to each' loop with the 'Add a row into a table' Excel action to write the SQL results into your SharePoint workbook.




