Converting HTML to Excel is most effectively achieved by using the "Get Data from Web" feature in Microsoft Excel or by copying and pasting a rendered HTML table directly into a spreadsheet. This process transforms structured web data (HTML tables) into a manipulatable grid of cells, allowing for data analysis, sorting, and calculations that are impossible in a standard web browser. Depending on whether you have a live URL or a local .html file, the method varies slightly, but the goal remains the same: extracting the <table> tags and their contents into rows and columns.

What You'll Need

  • A computer with Microsoft Excel installed (Office 365, Excel 2019, 2016, or newer).
  • A web browser (Chrome, Firefox, Edge, or Safari) to view the HTML source.
  • The URL of the webpage containing the data or a saved .html file on your local drive.
  • An active internet connection if you are importing data directly from a live website.

Step-by-Step

There are three primary ways to handle this conversion depending on the complexity of the data and your access to the source. Note that menu labels may differ slightly depending on your version of Excel or your regional settings.

Method 1: Using "Get Data from Web" (Best for Live URLs)

  1. Open Microsoft Excel and create a new blank workbook.
  2. Navigate to the Data tab on the top ribbon.
  3. Look for the Get & Transform Data section and click on From Web.
  4. A dialog box will appear asking for the URL. Paste the full web address (including http:// or https://) of the page containing the HTML table and click OK.
  5. Excel will connect to the page and open a Navigator window. This window scans the HTML code for any <table> elements.
  6. In the left-hand pane of the Navigator, you will see a list of tables found on the page (e.g., Table 0, Table 1). Click on each table to see a preview of the data in the right-hand pane.
  7. Once you find the table you want, you have two choices: click Load to bring the data directly into your sheet, or click Transform Data if you need to remove columns, filter rows, or change data types before importing.
  8. If you chose Transform Data, the Power Query Editor will open. Make your changes and then click Close & Load in the top left corner.

Method 2: Copy and Paste (Best for Simple, Small Tables)

  1. Open your web browser and navigate to the page containing the HTML table.
  2. Use your mouse to highlight the entire table, starting from the top-left header cell and dragging down to the bottom-right data cell.
  3. Right-click the highlighted area and select Copy (or press Ctrl+C on Windows / Cmd+C on Mac).
  4. Open your Excel workbook and select the cell where you want the top-left corner of the table to begin.
  5. Right-click the cell. Under Paste Options, you will see several choices. To maintain the look of the website, choose Keep Source Formatting. To make it look like a standard spreadsheet, choose Match Destination Formatting.
  6. Review the data to ensure that merged cells in HTML didn't cause shifts in the Excel columns.

Method 3: Opening an HTML File Directly (Best for Local Files)

  1. Save the webpage to your computer. In your browser, go to File > Save Page As and ensure the format is set to Webpage, HTML only.
  2. Launch Microsoft Excel.
  3. Go to File > Open and browse to the folder where you saved the .html file.
  4. In the file type dropdown menu (usually set to "All Excel Files"), change it to All Files (*.*) or Web Pages so the .html file becomes visible.
  5. Select the file and click Open.
  6. Excel will interpret the HTML tags and render the tables as spreadsheet data.
  7. Immediately go to File > Save As and change the file extension from .html to Excel Workbook (.xlsx) to ensure your changes are saved in a native spreadsheet format.

Common Mistakes

One of the most frequent errors is attempting to import a page that uses JavaScript to load its data. Many modern websites use "Dynamic HTML," where the table isn't actually in the HTML source code when the page first loads, but is generated by a script after the page opens. If you use the "From Web" tool on these pages, Excel may report that no tables were found because it only reads the static HTML source.

Another common mistake is ignoring the "Transform Data" step. HTML tables often contain hidden characters, non-breaking spaces (&nbsp;), or merged cells (colspan/rowspan). If you simply "Load" the data, you may find that your numbers are treated as text, making it impossible to perform sums or averages. Always check the data types in the Power Query Editor to ensure numbers are formatted as decimals or integers.

Users also frequently forget to save the file as an .xlsx after opening a local .html file. If you simply click "Save," Excel may try to save it back as an HTML file, which does not support Excel-specific features like formulas, macros, or multiple sheets.

Tips

To handle messy HTML data, use the Text to Columns feature in the Data tab. If the HTML import puts multiple pieces of information into a single cell (separated by commas or semicolons), you can split them into separate columns easily.

For very large tables that span multiple pages (pagination), the "From Web" tool will only grab the current page. To get all the data, you may need to use a specialized web scraping tool or a browser extension that can export the entire dataset to a CSV file, which Excel can then open natively.

If the formatting is erratic after pasting, use the Clear Formats button (found in the Home tab under the Editing group) to strip away the HTML styling and start with a clean, professional-looking spreadsheet.

Troubleshooting

If the "From Web" tool fails to find any tables, first check if the website requires a login. Excel's basic web import cannot bypass authentication screens or CAPTCHAs. If the data is behind a login, the Copy and Paste method is the most reliable workaround.

If the data appears shifted or columns are misaligned, it is likely due to <td colspan="..."> tags in the HTML. These are merged cells. To fix this, you will need to manually insert cells or move data to align the columns correctly. There is no automatic way in Excel to "unmerge" HTML cells during the import process; it must be done manually after the data is loaded.

If you encounter a "Connection Timeout" or "Access Denied" error when using the Data tab, check your firewall or proxy settings. Some corporate networks block Excel from making outbound HTTP requests. In these cases, saving the page as a local .html file and opening it directly in Excel (Method 3) usually bypasses the network restriction.

If numbers are appearing as text (indicated by a small green triangle in the corner of the cell), select the affected range, click the warning icon that appears, and select Convert to Number.

Frequently Asked Questions

Can I convert HTML to Excel without using Microsoft Excel?

Yes, you can use Google Sheets by using the =IMPORTHTML("url", "table", index) function, which allows you to pull specific tables from a website directly into a sheet.

Will the images from the HTML page be imported into Excel?

Generally, no. The "From Web" tool and standard copy-pasting focus on textual data within table cells. Images are usually ignored or replaced by the image's alt-text.

Does this work for CSV files?

CSV files are different from HTML. While HTML uses tags, CSV is plain text. For CSVs, use Data > From Text/CSV instead of "From Web."

Why is my data appearing in one single column?

This happens when the HTML is not structured as a proper table (using <table>, <tr>, and <td> tags) but instead uses <div> or <span> tags to mimic a table. In this case, Excel cannot recognize the grid structure.

Can I automate this process for daily updates?

Yes. If you use the "From Web" method, you can right-click the imported table and select Properties. Under the Refresh Control section, you can set the data to refresh automatically every X minutes or every time the file is opened.