Convert Excel tables to HTML

Convert Excel tables to HTML using "Save as Web Page" option


Using this method you can save an entire workbook or any portion of it, such as a selected range of cells or chart, to a static web page (.htm or .html) so that anyone can view your Excel data on the web.

For example, you have created a feature-rich report in Excel and now want to export all the figures along with a pivot table and chart to your company's web-site, so that your workmates can view it online in their web-browsers without opening Excel.

The original Excel table to be converted to an HTML file

To convert your Excel data to HTML, perform the following steps. These instructions apply to all "ribboned" versions of Excel 2016, 2013, 2010 and 2007:

  1. On the workbook, go to the File tab and click Save As.

    If you want to export some portion of data only, e.g. a range of cells, pivot table or graph, select it first.

  2. In the Save As dialog, choose one of the following:
    • Web Page (.htm; .html). This will save your workbook or the selection to a web page and create a supporting folder that will store all of the page's supporting files such as images, bullets and background textures.
    • Single File Web Page (.mht; .mhl). This will save your workbook or the selection to a single file with supporting files embedded into the web page.

    Saving an Excel worksheet as a webpage

  3. If you selected a range of cells, a table or a chart before clicking Save as, then select the Selection radio button, click Save and you are close to finished.
  4. If you selected a range of cells, a table or a chart before clicking Save as, then select the Selection radio button, click Save and you are close to finished.Saving the selected part of an Excel workbook as web page


    If you have not selected anything yet, continue with the following steps.

    • To save the entire workbook, including all the worksheets, graphics and tabs for navigating between sheets, select Entire Workbook.
    • To save the current worksheet, choose Selection: Sheet. In the next step you will be given a choice whether to publish the whole worksheet or some of the items.

    Save the entire workbook or the selection.

    You can also set a title for your web-page now by clicking the Change Title... button in the right-hand part of the dialog window. You will also be able to set or change it later, as described in step 6 below.

  5. Click the Publish button and this will open the Publish as Web Page dialog window. Let's briefly go through each of the available options, from top to bottom.
  6. Items to publish. Here you choose what portion(s) of your Excel workbook you want to export to a web-page.

    In the drop-down list next to Choose, you have the following choices:

    • Entire workbook. The whole workbook will be published, including all of the worksheets and tabs to navigate between sheets.
    • Entire worksheet or certain items on a worksheet, such as pivot tablescharts, filtered ranges and External data ranges. You select "Items on SheetName", and then choose either "All contents" or particular items.
      Choose whether to publish the entire worksheet or certain items.
    • Ranges of cells. Select Range of cells in the drop-down list and then click the Collapse Dialogicon to select the cells you want to publish.
    • Previously published items. Select this option if you want to republish a worksheet or items you have already published. If you'd rather not republish a certain item, select the item in the list and click the Remove button.
  7. Title of the web-page. To add a title that will be displayed in the title bar of the browser, click the Change button next to Title: and type in the title you want.
    Adding a web-page's title
  8. Click the Browse button next to File name and choose the hard drive, folder, web folder, web server, HTTP site, or FTP location where you want to save your web page.

    Tips: If you are converting an Excel workbook to an HML file for the first time, it makes sense to save the web page onto your local hard drive first so that you can make the needed corrections before publishing the page on the web or your local network.

    You can also choose to export your Excel file to an existing web page provided that you have permissions to modify it. In this case, upon clicking the Publish button, you will see a message prompting you to choose whether you want to overwrite the content of the existing web-page or append your data to the end of the web page. If the former, click Replace; if the latter, click Add to file.

  9. Select "AutoRepublish every time this workbook is saved" if you want to have the workbook or selected items automatically republished after each saving of the workbook. I'll explain the AutoRepublish feature in more detail further on in the article.
  10. Select the "Open published Web page in browser" check box in case you want to view the web page right after saving.
  11. Click the Publish button and you are done!

    As you can see in the screenshot below, our Excel table looks fairly nice online, though the design of the original Excel file is a bit distorted.

    An Excel table published as a web page

    Note: The HTML code created by Excel is not very clean and if you are converting a large spreadsheet with a sophisticated design, it may be a good idea to use some HTML editor to clean up the code before publishing so that it will load more quickly onto your web site.
  12. 5 things you should be aware of when converting an Excel file to HTML

    When you use Excel's Save as Web Page function, it is important that you understand how its main features work in order to avoid most typical mistakes and prevent common error messages. This section provides a quick overview of the options you should pay special attention to when exporting your Excel spreadsheet to HTML.


  13. Supporting files and hyperlinks

    As you know, web pages often contain images and other supporting files as well as hyperlinks to other web-sites. When you convert an Excel file to a web page, Excel automatically manages the related files and hyperlinks for you and saves them to the supporting files folder, named WorkbookName_files.

    When you save the supporting files such as bullets, graphics and background textures to the same web server, Excel maintains all the links as relative links. A relative link (URL) points to a file within the same web site; it specifies the file name or a root folder only rather than the full website address (e.g. href="/images/001.png"). When you delete any item saved as a relative link, Microsoft Excel automatically removes the corresponding file from the supporting folder.

    So, the main rule is to always keep the web page and supporting files in the same location, otherwise your web page may no longer display properly. If you move or copy your web page to another location, be sure to move the supporting folder to the same location to maintain the links. If you re-save the web page to another location, Microsoft Excel will copy the supporting folder for you automatically.

    When you save your web pages to different locations or if your Excel files contain hyperlinks to external web sites, absolute links are created. An absolute link specifies the full path to a file or a web-page that can be accessed from anywhere, e.g. www.your-domain/products/product1.htm.

  14. Making changes and re-saving a Web page

    In theory, you can save your Excel workbook as a Web page, then open the resulting web page in Excel, make edits and re-save the file. However, in this case some Excel features will no longer be working. For example, any charts contained in your workbook will become separate images and you won't be able to modify them in Excel as usual.

    So, the best practice is to maintain your original Excel workbook up to date, make changes in the workbook, always save it as a workbook (.xlsx) first and then save as a Web page file (.htm or .html).

  15. AutoRepublishing a Web page

    If you selected the AutoRepublish checkbox in the Publish As Web Page dialog discussed in step 8 above, then your web page will get updated automatically every time you save your Excel workbook. This is a really helpful option that lets you always maintain an up-to-date online copy of your Excel table.

    If you have turned on the AutoRepublish feature, a message will appear each time you save the workbook asking you to confirm whether you want to enable or disable AutoRepublish. If you want to have your Excel spreadsheet republished automatically, then naturally select Enable...and click OK.
    Enabling the AutoRepublish feature

    However, there are some circumstances when you may not want to republish your spreadsheet or selected items automatically, e.g. if your Excel file contains confidential info or has been edited by someone who is not a trusted source. In this case, you can make AutoRepublish temporarily or permanently unavailable.

    To temporarily disable AutoRepublish, select the first option "Disable the AutoRepublish feature while this workbook is open" in the above-mentioned message. This will turn off auto-republishing for the current session, but it will be enabled again the next time you open the workbook.

    To permanently disable AutoRepublish for all or selected items, open your Excel workbook, choose to save it as Web page and then click the Publish button. In the Choose list, under "Items to publish", select the item you do not want to republish and click the Remove button.
    Permanently disabling the AutoRepublish feature

  16. Excel features not supported in web pages

    Regrettably, a couple of very useful and popular Excel features are not supported when you convert your Excel worksheets to HTML:

    • Conditional formatting is not supported when saving an Excel spreadsheet as a Single File Web Page (.mht, .mhtml), so make sure you save it in the Web Page (.htm, .html) format instead. Data bars, color scales, and icon sets are not supported in either web page format.
    • Rotated or vertical text in not supported either when you export Excel data online as a Web page. Any rotated or vertical text in your workbook will be converted to horizontal text.
  17. Most common issues when converting Excel files to HTML

    When converting your Excel workbook to a web page, you may run into the following known issues:

    • Cell's content (text) is truncated or not completely displayed. To prevent text from being cut off, you can either turn off the wrapped text option, or shorten the text, or widen the column width, also make sure the text is aligned to the left.
    • The items you save to an existing Web page always appear at the bottom of the pagewhile you want them at the top or in the middle of the page. This is a normal behavior when you choose to save your Excel file as an existing web page. To move your Excel data to another position, either edit the resulting web-page in some HTML editor or rearrange the items in your Excel workbook and save it as a web page anew.
    • Links on the web page are broken. The most obvious reason is that you have moved either the web page or the supporting folder to another location. See supporting files and hyperlinks for more details.
    • A red cross (X) is displayed on the Web page. A red X indicates a missing image or other graphic. It may get broken for the same reason as hyperlinks. Just make sure you always keep the web-page and supporting folder in the same location.