How to Fix Power Query Errors with OneDrive Personal Excel Links
Question details
The user needs to resolve an HTML data type error that occurs in Power Query when attempting to import data from an Excel file hosted on OneDrive Personal.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Importing Excel data from a OneDrive Personal share link using the Web.Contents function in Power Query.
- Observed behavior
- Power Query returns an HTML data type error because the OneDrive download URL redirects to a web page (such as a file viewer or sign-in page) instead of returning the raw Excel file.
Make sure you have the exact sharing link from your OneDrive Personal account and verify that the file is not restricted by specific sign-in permissions that block automated web queries.
Modify the OneDrive Link for Direct Download
Power Query requires a direct file link to read the data correctly. You must manually alter the standard OneDrive Personal sharing URL to bypass the web viewer and force a file download.
By default, OneDrive Personal sharing links are designed for browsers and load an HTML-based Excel viewer. Power Query cannot parse this HTML interface, which is why the data type error occurs.
Navigate to your file in OneDrive Personal, right-click the Excel file, select 'Share', and copy the standard sharing link.
Paste the link into a text editor. Look at the end of the URL; if it ends with '?web=1' or similar parameters, change it to '?download=1'. In some link structures, you may need to replace the word 'embed' with 'download' in the URL path.
Open Excel, go to the 'Data' tab, click 'Get Data' > 'Data Source Settings'. Locate your previous OneDrive connection, click 'Change Source', and paste the newly modified direct-download URL.

Clear and Reset Data Source Permissions
Outdated or incorrect authentication methods can cause OneDrive to redirect Power Query to a login page, resulting in an HTML document error.
Seek Help from the Excel Community
If Microsoft changes OneDrive URL structures and the issue persists, consulting Power Query specialists in official forums is the best next step.
Try WPS Office for Seamless Spreadsheet Management
If you are frustrated by complex Power Query errors, authentication issues, and broken OneDrive links in Microsoft Excel, WPS Office offers a highly compatible, free, and lightweight alternative. Enjoy a familiar interface and robust spreadsheet tools without the complex cloud setup.
- 1. Download and Install: Visit the official WPS Office website and download the free version for your operating system.
- 2. Open Your Excel File: Launch WPS Spreadsheets and open your existing .xlsx files directly, preserving all your data and formatting.
- 3. Work Without Hassle: Use WPS Office's built-in data tools to filter, analyze, and manage your data without worrying about complex web query errors.

Frequently Asked Questions
Why does Power Query return an HTML error for my Excel file?
This happens when the provided OneDrive link redirects Power Query to a web-based file viewer or a login page instead of the direct raw file. Power Query attempts to read the webpage's HTML code instead of the actual spreadsheet data.
Can I use OneDrive Business links the same way as OneDrive Personal?
No, OneDrive for Business uses SharePoint's backend and requires 'Organizational account' authentication in Power Query. Personal links generally require modifying the URL for direct download and using 'Anonymous' access.
How do I safely share my Power Query issue online?
Always remove sensitive data, private access keys, and personal authentication tokens from your Web.Contents URL and M code before posting in public forums or communities.




