Jomatter

How to Import an HTML File Into Excel

You can import an HTML file into Excel in two practical ways: open the .html or .htm file directly in Excel, or use Power Query when you need to extract specific HTML tables and control how the data is loaded. Excel supports HTML and MHTML web-page formats, and Microsoft documents HTML as a supported file format.

Method 1: Open the HTML File Directly in Excel

For a local HTML file that already contains a normal table, direct opening is the simplest method.

  1. Open Microsoft Excel.
  2. Select File > Open.
  3. Browse to the folder containing the .html or .htm file.
  4. Select the HTML file and choose Open.
  5. Review the imported content in the worksheet.
  6. Save the result as an Excel workbook by selecting File > Save As and choosing Excel Workbook (*.xlsx).

Excel recognizes .htm and .html as Web Page file formats, and Microsoft’s Excel documentation confirms that HTML documents can be opened in Excel.

Use this method when the HTML file contains a normal table and you mainly need the data in Excel. Because HTML is a web format, formatting and some page elements may not transfer exactly. Microsoft notes that changing file formats can cause some formatting, data, or features to be lost.

Method 2: Import the HTML Table with Power Query

Power Query is the better option when the HTML contains several tables, unnecessary page content, or data that needs cleaning before it reaches the worksheet.

For an HTML page available through a URL:

  1. Open Excel and open a workbook.
  2. Go to the Data tab.
  3. Select From Web. Depending on your Excel version, this may appear under Get Data > From Other Sources > From Web.
  4. Enter the URL of the HTML webpage and select OK.
  5. Excel opens the Navigator window and displays tables detected on the page.
  6. Select the table you need.
  7. Choose Load to place the data into Excel, or Transform Data to clean and reshape it first.

Microsoft describes the Web connector as a Power Query feature that detects web tables, previews them in Navigator, and loads selected data into an Excel worksheet.

Power Query is useful for repeatable imports because you can refresh the query later instead of manually copying the table again.

Importing a Local HTML File with Power Query

There is an important distinction between a local HTML file and an HTML webpage on the internet. Excel’s From Web connector is designed around a web-page URL. For a local .html file, direct opening is usually the simplest route. Microsoft’s Power Query documentation lists the Web connector separately, while its HTML/text guidance covers importing HTML files.

If the HTML file is difficult to open correctly, another practical option is to serve the file from a local or accessible web address and then use Data > From Web. This is most useful when the HTML contains multiple tables that need to be selected or transformed.

How to Save the Imported HTML Data as an Excel File

After the HTML data appears correctly in Excel, do not keep the working file in HTML format if your goal is a normal Excel spreadsheet. Use File > Save As, select Excel Workbook (*.xlsx), and save a new copy.

Saving as .xlsx gives you a native Excel workbook for normal spreadsheet work and avoids using the HTML document as the long-term working file.

Common Problems When Importing HTML into Excel

The table looks broken: The HTML may use complex layouts, merged cells, CSS, scripts, or nested tables. Use Power Query to isolate the actual table data instead of relying on the page’s visual layout.

Images or web-page formatting are missing: Excel is importing data into a spreadsheet, not reproducing the entire webpage. HTML page elements that are not structured as tabular data may not become worksheet cells.

The HTML file will not open as expected: Check that the file has an .html or .htm extension and contains valid HTML. Renaming an unrelated file to .html does not convert its format.

You need data from an online page: Use Data > From Web and let Power Query detect the available tables. Microsoft also notes that Excel for the web does not provide a direct IMPORTHTML function; desktop Excel can use Power Query for comparable webpage-table imports.

Which Method Should You Use?

For a simple local HTML file, start with File > Open and then save the result as .xlsx. For a webpage or structured HTML data that needs table selection, cleaning, transformation, or refreshes, use Power Query > From Web. Choose direct opening for simple conversion and Power Query for controlled extraction.

Also Read This Articles

How To Open A Link In A New Tab Html
How To Upload Html File To WordPress
How To Add Schema Markup To Html
How To Call A Function In Javascript From Html
How To Center An Iframe In Html
How To Change Plain Text Email To Html
How To Make Text Wrap Around An Image In Html
Are Html And Css Programming Languages
Do My Html Homework
How To Add Alt Tags To Images In Html
How To Integrate WordPress Blog Into Html Website