Import an HTML Table into Excel

In this article, I will show you how to import an HTML table into Excel. This will work for any data from a local HTML file or online URL that is stored in a table. I will import the HTML table in a way that the data can be updated if it changes, which is particularly valuable for online data. This will be done using a Get & Transform Query. As such, this method is only compatible with the Windows version of Microsoft Excel.

Step 1: Open File or URL in Query Editor

New York City Boroughs data table on wikipedia
Table to import in Excel

In this article, I will be using the NYC Boroughs table on the following Wikipedia page: You could also use a local file.

clicking Get Data, From Other Sources, From Web

To import data from the web, on the Data tab click Get Data > From Other Sources, From Web. If you have a local file, choose Get Data > From file > From XML instead.

Find the table you need in the Navigator

Once you open the file or URL, the Navigator will open. This shows all of the tables in the file. You may need to browse through the tables to find the one you need. Once you do, if everything looks exactly as you want it to appear in Excel, you can click Load. Otherwise, click Transform Data to clean up the table.

Step 2: Cleanup in Query Editor

Finished table in Query Editor

Once in the query editor, the steps will be unique for every table you desire to import. In this case, I needed to remove the left-most column, as it was filled with the name of a header. I also removed the first tow rows. Use the ribbon interface at the top to make changes. If you make a mistake, remove the step in the Applied Steps section.

Once the table is ready for Excel, click Close & Load.

Just like that, the table is imported! If you used a URL, you may wish to enable auto-update of the data. Click a cell in the table, go to the Query tab, click Properties. You will find options in the Properties dialog for background refresh and auto-update.

Thank you for reading. If you have any questions, please comment below.

3 thoughts on “Import an HTML Table into Excel”

  1. Dear all, I am facing with a following issue:
    when I import around 10 html documents, stored locally on my machine, result table is having less than 100 rows.
    But for those documents html that contain table with only one row, cells are empty.
    How can I solve this case?

    1. Also, when I import only that particular document, everything is fine, data are visible.

      Kind regards and thanks in advance

Leave a Reply

Your email address will not be published. Required fields are marked *