Fix Excel Power Query Connection Errors for OneDrive Files
Question details
The user needs to fix an issue where Power Query fails to connect to a macro-enabled Excel workbook (.xlsm) stored in OneDrive.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Attempting to import data into Power Query from an .xlsm file hosted on OneDrive by copying the file path from the Excel File > Info menu.
- Observed behavior
- Power Query throws an error stating that the file is not recognized as an Excel workbook because the copied path points to an HTML web page rather than the actual file.
Ensure you have the correct permissions to access the target file on OneDrive, and verify whether you have the OneDrive desktop sync client installed on your computer.
Use the Direct Local File Path
Replace the web-based URL with the local synchronization path provided by the OneDrive desktop client.
When you copy a link directly from Excel's Info panel, it often includes web parameters (like '?web=1') that turn the path into an HTML page link. Power Query cannot parse HTML as a workbook. Using the local sync path bypasses this issue.
Open Windows File Explorer and navigate to your local OneDrive synchronization folder where the target .xlsm file is stored.
Hold down the Shift key, right-click the target .xlsm file, and select 'Copy as path' from the context menu.
Open your destination Excel workbook, navigate to the Data tab, and launch the Power Query Editor. Go to the Source step in your query settings and replace the old web URL with the newly copied local file path.

Use Supported SharePoint or OneDrive Connectors
Use the built-in web connector by modifying the OneDrive URL, which is ideal if the OneDrive desktop app is not installed.
Switch to WPS Office for a Seamless Spreadsheet Experience
If you frequently encounter complex connection errors and heavy processing issues in Microsoft Excel, consider WPS Office. It provides a lightweight, highly compatible alternative for viewing, editing, and managing your spreadsheets without the heavy software overhead.
- 1. Download WPS Office: Visit the official WPS website and download the free installation package.
- 2. Install the Software: Run the installer to quickly set up WPS Office on your computer.
- 3. Open Your Workbooks: Launch WPS Spreadsheets and directly open your existing Excel files seamlessly.

Frequently Asked Questions
Why does Excel say my OneDrive file is not recognized as a workbook?
When copying a path from File > Info in Excel, it often includes a web suffix like '?web=1', making it an HTML web address. Power Query expects a direct file path or a raw file stream, so it fails to parse the HTML page as an Excel workbook.
Do I need the OneDrive desktop app installed to use Power Query with cloud files?
No, you do not strictly need it. You can connect to cloud files without the desktop app by using the 'From Web' connector in Power Query and pasting the file's SharePoint or OneDrive for Business URL (making sure to remove any web query parameters at the end of the link).
Where should I post advanced Power Query questions for troubleshooting?
Advanced Power Query and M-code questions are best posted in Microsoft Q&A forums or the dedicated Power Query forum within the Power Platform Community, where product experts and developers can provide specialized support.




