You may need to publish Excel data online or share it in a format viewable by any web browser. Excel can convert your workbook into a static web page. This feature saves your data and formatting into an HTML file. This article explains the steps to create an HTML file and the options available.
Key Takeaways: Saving Excel as HTML
- File > Save As > Web Page: Saves the entire workbook or selected sheets as a single HTML file with a supporting folder.
- Publish as Web Page dialog: Lets you choose specific items like a range of cells or a chart to publish interactively.
- File > Export > Change File Type > Web Page: An alternative path to access the Save As dialog for web formats.
Understanding Excel’s HTML Export Feature
Excel’s Save as Web Page feature converts spreadsheet data into Hypertext Markup Language. This is the standard language for web pages. The conversion creates an HTML file and a folder containing supporting files like images and style sheets. The resulting web page is static. This means viewers cannot edit the data directly in their browser like they can in Excel.
You can publish an entire workbook, a single worksheet, or a specific range of cells. Basic formatting such as fonts, cell colors, and borders is preserved. Complex Excel features like formulas, macros, and pivot table interactivity are not saved. The HTML file will display only the last calculated values. Before saving, review your workbook and remove any sensitive data not meant for public viewing.
Steps to Save an Excel File as HTML
The primary method uses the Save As dialog. Ensure your workbook is ready and saved in its original .xlsx format first.
- Open the Save As dialog
Click File > Save As. Then click Browse to open the full Save As dialog box. - Choose the save location and file type
Navigate to the folder where you want to save the HTML file. Click the “Save as type” dropdown list. Select “Web Page (*.htm; *.html)”. - Configure what to publish
In the dialog, you will see a “Publish” button and options. To save the entire workbook, ensure “Entire Workbook” is selected under the “Publish what” section. To save only the active sheet, select “Selection: Sheet”. - Set the page title and filename
Click the “Change Title” button to set a title that will appear in the browser’s title bar. Type your desired filename in the “File name” box. - Save the file
Click Save. A message may appear stating that some features may not be preserved. Click Yes to continue. Excel creates an .htm or .html file and a folder with the same name plus “_files” containing supporting assets.
Using the Publish as Web Page Dialog
For more control, use the Publish as Web Page dialog. This allows you to publish specific items like a named range or a chart.
- Access the Publish dialog
Follow steps 1 and 2 above. Instead of clicking Save, click the “Publish…” button in the Save As dialog. - Choose item to publish
In the Publish as Web Page dialog, open the “Choose” dropdown. You can select items like “Items on Sheet1” to pick a specific range or chart object. - Set interactivity and publishing options
Check the “AutoRepublish every time this workbook is saved” box if you want the HTML to update automatically. For simple static output, leave this unchecked. Click Publish to generate the files.
Common Mistakes and Limitations
Formulas and Dynamic Features Are Lost
The HTML output is a snapshot. All formulas are replaced by their current values. Any interactive Excel feature like data validation drop-downs or slicers will not work. If you need interactivity, consider saving the file to Microsoft’s cloud service and sharing a link with edit permissions instead.
Supporting Files Folder Is Required
Excel creates a separate folder for images and styles. Both the .htm file and its accompanying folder must be kept together and moved together. If you email only the .htm file, the recipient will see a broken page with missing formatting and images.
File Size Can Increase Significantly
A simple worksheet can produce a large HTML file and many supporting files. This is because Excel’s formatting is converted into verbose HTML and CSS code. For posting online, you may need to compress the entire set of files into a .zip archive.
Browser Compatibility Varies
The HTML generated is designed for modern browsers but may not display identically in all of them. Always open the .htm file in multiple browsers like Chrome, Edge, and Firefox to check the appearance before distributing it widely.
Save As Web Page vs. Single File Web Page
| Item | Web Page (*.htm) | Single File Web Page (*.mht) |
|---|---|---|
| Output Format | One .htm file plus a folder of supporting files | One single .mht file with all resources embedded |
| Portability | Requires moving two items together | Easier to email or transfer as one file |
| Browser Support | Widely supported by all browsers | Primarily supported by Internet Explorer and Edge; may not open correctly in others |
| Best For | Posting on a web server where folder structure is maintained | Quick sharing via email when recipients use compatible browsers |
You can now publish your Excel data directly to the web. Use File > Save As and select the Web Page format. Remember that the output is a static snapshot suitable for viewing. For your next project, try using the Publish dialog to export only a specific chart. A useful advanced tip is to use Excel’s camera tool to take a picture of a range before saving as HTML for more precise layout control.