Fix Excel Published HTML Showing Source Code on OneDrive
Question details
The user is experiencing an issue where an Excel workbook published as an HTML file displays raw HTML source code instead of the rendered spreadsheet when stored or opened via OneDrive.

- Product
- Microsoft Excel, OneDrive
- Device & OS
- not provided
- Scenario
- Opening or embedding an Excel-published HTML file hosted on OneDrive in a web browser.
- Observed behavior
- Newly uploaded HTML files display as raw HTML text in the browser, whereas local copies and older HTML files uploaded previously to OneDrive render the workbook correctly.
Ensure you have both the main HTML file and its associated support folder saved locally on your computer, as both are required for the web page to render correctly.
Verify Local Files and Upload the Complete HTML Package
Ensure the published HTML file works locally and that all necessary support files are uploaded to OneDrive to prevent rendering errors.
When Excel publishes a workbook to HTML, it typically generates a primary HTML file and a separate folder containing vital scripts, styles, and images. Missing this folder can cause display issues.
Additionally, verifying the file locally confirms that the export process was successful and isolates the problem to OneDrive's handling of the file.
Publish your Excel workbook to HTML and save it directly to a local folder on your computer's hard drive.
Double-click the local .htm or .html file to open it in your default web browser. Confirm that the workbook displays correctly instead of showing source code.
Log into OneDrive and manually upload both the main HTML file and the corresponding support folder (e.g., filename_files) into the same directory.
Generate a sharing link from OneDrive and open it in an incognito or private browsing window to verify the file rendering.
Report the Handling Issue to Microsoft Support
If local copies render correctly but newly uploaded OneDrive copies show source code, the issue stems from changes in OneDrive's HTML handling or security policies.
Try WPS Office for Seamless Spreadsheet Sharing
If you are struggling with Excel's HTML publishing features and OneDrive's rendering issues, WPS Office offers a free, lightweight, and highly compatible alternative. You can effortlessly create, edit, and share spreadsheets online via secure links without worrying about complex HTML embedding issues.
- 1. Install WPS Office: Download and install the free WPS Office suite on your computer or mobile device.
- 2. Open Your Spreadsheet: Launch WPS Spreadsheet and seamlessly open your existing .xlsx or .xls file.
- 3. Share via Secure Link: Click the 'Share' button in the top right corner to generate a direct, viewable web link without needing to publish or troubleshoot HTML files.

Frequently Asked Questions
Why does my Excel HTML file show code on OneDrive but not locally?
Cloud storage platforms like OneDrive frequently update their security measures. To prevent malicious scripts from executing, OneDrive may treat newly uploaded HTML files as plain text, causing the browser to display the raw source code instead of rendering the web page.
Do I need to upload the support folder when publishing Excel to HTML?
Yes. When Excel publishes a workbook as a webpage, it creates a main HTML file and an associated support folder containing images, formatting, and scripts. Both must be uploaded to the exact same directory for the page to display properly.
Can I embed an Excel file on a webpage without publishing it as HTML?
Yes. Instead of manually publishing to HTML, you can use Excel for the Web to generate a direct embed code snippet (iframe) from the sharing settings. This method relies on Microsoft's built-in viewer and is often much more reliable than hosting raw HTML files.




