To load HTML into Excel, the most efficient method is using the Get Data feature (Power Query), which allows you to pull tables directly from a URL and keep them synced. Alternatively, you can open an .html file directly through the Open menu or copy and paste the content from a browser. This process converts unstructured or semi-structured web data into a clean spreadsheet format for analysis, reporting, or archiving.
What You'll Need
- A computer with Microsoft Excel installed (Office 365, Excel 2016, 2019, or 2021 are recommended for full Power Query support).
- A stable internet connection if you are importing from a live website.
- The URL of the webpage containing the data, or a saved .html file on your local drive.
- Administrative permissions to save files to your local directory if you are downloading the HTML first.
Step-by-Step
Method 1: Using Power Query (Best for Live Tables)
This is the professional way to import HTML because it recognizes <table> tags and allows you to refresh the data if the website updates. Note that menu labels may differ slightly depending on your version of Excel or regional settings.
- Open a blank workbook in Microsoft Excel.
- Navigate to the Data tab on the top ribbon.
- Click on Get Data, then hover over From Other Sources and select From Web. (In some versions, there is a direct From Web button on the Data tab).
- A dialog box will appear. Paste the full URL of the webpage into the URL field and click OK.
- If prompted for access (Anonymous, Windows, or Basic), select Anonymous for public websites and click Connect.
- The Navigator window will open. Excel will scan the HTML of the page for any data formatted as a table. On the left pane, you will see a list of tables found on that page (e.g., Table 0, Table 1).
- Click on a table name to see a preview of the data in the right pane.
- If the data looks correct, click Load to bring it directly into the sheet. If the data needs cleaning (e.g., removing empty columns or filtering rows), click Transform Data to open the Power Query Editor.
- Once loaded, the data appears as an Excel Table. To update it later, right-click anywhere in the table and select Refresh.
Method 2: Opening a Local .html File
Use this method if you have already saved a webpage to your computer as an .html file.
- Launch Microsoft Excel.
- Click on File in the top left corner and select Open.
- Click Browse to open the file explorer.
- In the file type dropdown menu (usually set to "All Excel Files"), change the selection to All Files (*.*) or Web Pages (*.htm; *.html).
- Locate your .html file on your hard drive, select it, and click Open.
- Excel will attempt to render the HTML layout. Tables will generally be preserved, but images and complex CSS styling will be stripped away.
- Save the file as an Excel Workbook (.xlsx) immediately to ensure the data is stored in a native spreadsheet format.
Method 3: The Copy-Paste Method (Quickest for Small Data)
This is best for one-time imports of small tables where you do not need the data to be dynamic.
- Open your web browser and navigate to the page containing the data.
- Use your mouse to highlight the table or the specific HTML elements you want to move.
- Right-click and select Copy (or press
Ctrl + C). - Open your Excel workbook and select the cell where you want the top-left corner of the data to start.
- Right-click and look at the Paste Options. You can choose Keep Source Formatting to try and maintain the look of the website, or Match Destination Formatting to make it look like a standard Excel sheet.
- Press
Ctrl + Vto paste.
Common Mistakes
One of the most frequent errors is attempting to import data from a website that uses JavaScript to render its tables. Power Query reads the static HTML source code. If a table is generated dynamically after the page loads in a browser, Excel may report that no tables were found. In these cases, the "From Web" tool cannot see the data because it doesn't exist in the initial HTML response.
Another common mistake is failing to save a file opened from HTML as an .xlsx file. If you simply click "Save," Excel may try to save it back as an HTML file or a CSV, which can strip away any formulas or formatting you added after the import.
Users often forget to check for merged cells. HTML tables frequently use colspan or rowspan attributes. When Excel imports these, it may shift your columns to the right or create empty cells, which can break your data analysis if you are using VLOOKUP or Pivot Tables. Always audit the first few rows of your import to ensure the headers align with the data.
Tips
To handle messy imports, use the Transform Data option in Power Query. This allows you to use "Use First Row as Headers" if Excel didn't automatically detect them, or "Fill Down" to fill in gaps created by merged cells in the original HTML.
If you are importing a very large HTML table, avoid the copy-paste method. Copying thousands of rows from a browser can cause the browser to freeze or result in truncated data. Power Query is significantly more stable for large datasets as it streams the data directly from the server.
For websites that require a login, the "From Web" tool can be tricky. If the site uses a complex authentication system (like Multi-Factor Authentication), the standard Excel connector may fail. In these instances, the best workaround is to log into the site in your browser, save the page as an .html file (Ctrl + S), and then use Method 2 to open that local file in Excel.
Troubleshooting
If Excel says "No tables found" during the From Web process: First, check if the data is actually in an HTML <table> tag. Right-click the webpage in your browser and select View Page Source. Search (Ctrl + F) for "<table". If you don't find any, the data is likely stored in <div> tags or generated by JavaScript. In this case, the copy-paste method is your only viable option.
If the data looks garbled or has strange symbols: This is usually an encoding issue (e.g., UTF-8 vs. ANSI). In the Power Query Transform Data window, go to the Source step in the Applied Steps pane. Click the gear icon and change the File Origin dropdown to "65001: Unicode (UTF-8)".
If the connection times out: This can happen with slow servers or restrictive firewalls. Try saving the page as an HTML file locally first, then importing the local file. If you are on a corporate network, ensure that Excel has permission to access the external URL through your firewall settings.
If the formatting is completely broken: If the copy-paste method creates a mess, try pasting into a plain text editor (like Notepad) first to strip all HTML tags, then copying from Notepad into Excel. Alternatively, use the Paste Special menu in Excel and select Text or Unicode Text.
Frequently Asked Questions
Can I automatically update the HTML data in Excel?
Yes, if you use the From Web (Power Query) method. You can right-click the table and select Refresh, or go to Data > Properties to set the table to refresh automatically every X minutes or whenever the file opens.
Does this work with Google Sheets?
While the steps above are for Excel, Google Sheets has a similar function called =IMPORTHTML("url", "table", index). This is a formula-based approach rather than a menu-based one.
Why are some columns missing after the import?
This usually happens because the HTML source uses nested tables or non-standard tags. Use the Transform Data editor to check if the missing columns are hidden or if they were imported as part of a combined column that needs to be split.
Can I import data from a password-protected page?
It is difficult to do this directly via the "From Web" tool if the site uses modern security. The most reliable way is to log in via your browser, save the page as an .html file, and then open that file in Excel.
Will importing HTML bring in the website's images?
Generally, no. Excel is designed to handle tabular data. While it may occasionally bring in a small icon or a linked image, it will not replicate the visual layout of the website. It focuses on the text and numbers within the cells.
Is there a limit to how much HTML data Excel can load?
Excel is limited by its total row count (1,048,576 rows). However, the browser or the web server may time out before you reach that limit. For massive datasets, consider exporting the data to a CSV file from the source if available.