HTML Tables to Excel: 5 Methods Compared

You've found the data you need on a webpage, neatly organized in an HTML table. Now you need it in Excel. Sounds simple enough, but the path from <table> to .xlsx is littered with formatting headaches, merged cell nightmares, and broken character encodings.

In this article, we'll compare five practical methods for converting HTML tables to Excel spreadsheets—from dead-simple copy-paste to full programmatic solutions. We'll cover the pros, cons, and difficulty level of each approach so you can pick the right one for your situation.

Method 1: Copy and Paste

The simplest approach: select the table in your browser, copy it, and paste it into Excel.

How It Works

  1. Open the webpage containing the table in your browser.
  2. Click and drag to select the entire table (or use Ctrl+A if the table is the only content).
  3. Press Ctrl+C to copy.
  4. Open Excel and press Ctrl+V to paste.
  5. Clean up formatting as needed.

Pros

  • Zero setup required—works with any browser and any version of Excel.
  • Handles simple tables with plain text and numbers well.
  • Fastest method for one-off extractions.

Cons

  • Merged cells often paste incorrectly, creating blank rows or columns.
  • Hyperlinks, images, and embedded styles are lost or mangled.
  • Multi-table pages require careful selection to avoid grabbing extra content.
  • Not repeatable—you'll need to do it manually every time the data updates.
  • Special characters and Unicode may not survive the clipboard transfer.

Best for: Quick, one-time grabs of simple tables with fewer than 100 rows.

Method 2: Browser Extensions

Several browser extensions are designed specifically for extracting table data from web pages. Popular options include Table Capture (Chrome), Copyfish, and Data Scraper.

How It Works

  1. Install a table extraction extension from your browser's extension store.
  2. Navigate to the page with the table.
  3. Click the extension icon—it automatically detects tables on the page.
  4. Select the table you want and export as CSV or XLSX.

Pros

  • Automatic table detection saves time on complex pages.
  • Most extensions support direct XLSX or CSV export.
  • Handles multiple tables on a single page.
  • Some extensions support pagination and lazy-loaded tables.

Cons

  • Requires installing a third-party extension—potential privacy and security concerns.
  • Extension quality varies widely. Some are abandoned or poorly maintained.
  • May not work on tables rendered dynamically with JavaScript frameworks (React, Vue).
  • Limited control over output formatting.
  • Some extensions inject ads or require paid upgrades for basic features.

Best for: Regular table extraction from multiple pages without writing code.

Method 3: JavaScript with SheetJS (xlsx)

For developers who need programmatic control, SheetJS (also known as the xlsx library) is the gold standard for client-side spreadsheet generation in JavaScript.

How It Works

SheetJS can parse an HTML table element directly from the DOM and convert it into an Excel workbook—all in the browser, with no server required.

<!-- Include SheetJS from CDN -->
<script src="https://cdn.sheetjs.com/xlsx-0.20.0/package/dist/xlsx.full.min.js"></script>

<script>
function exportTableToExcel(tableId, filename) {
    // Grab the HTML table element
    const table = document.getElementById(tableId);
    
    // Convert the table to a workbook
    const workbook = XLSX.utils.table_to_book(table, { sheet: "Sheet1" });
    
    // Generate and download the file
    XLSX.writeFile(workbook, filename + ".xlsx");
}
</script>

<table id="data-table">
    <thead>
        <tr><th>Name</th><th>Revenue</th><th>Growth</th></tr>
    </thead>
    <tbody>
        <tr><td>Product A</td><td>$1,200,000</td><td>15%</td></tr>
        <tr><td>Product B</td><td>$890,000</td><td>22%</td></tr>
    </tbody>
</table>

<button onclick="exportTableToExcel('data-table', 'report')">
    Download Excel
</button>

Pros

  • Runs entirely in the browser—no server-side processing needed.
  • Preserves table structure, merged cells, and basic formatting.
  • Supports multiple sheets, custom column widths, and cell styles (with the Pro version).
  • Can also parse existing Excel files, making round-trip conversions possible.
  • Actively maintained with excellent documentation.

Cons

  • Requires JavaScript knowledge to implement.
  • Advanced styling (colors, fonts, borders) requires the paid SheetJS Pro license.
  • Large tables (100,000+ rows) can cause performance issues in the browser.
  • Only works with tables already in the DOM—you need to fetch and parse external HTML separately.

Best for: Adding "Export to Excel" functionality to your own web applications.

Method 4: Python with BeautifulSoup + openpyxl

For server-side processing, batch conversions, or scraping tables from external websites, Python offers a powerful combination: BeautifulSoup for HTML parsing and openpyxl for Excel file creation.

How It Works

import requests
from bs4 import BeautifulSoup
from openpyxl import Workbook

# Fetch the webpage
url = "https://example.com/data-table"
response = requests.get(url)
soup = BeautifulSoup(response.content, "html.parser")

# Find the table
table = soup.find("table")

# Create a new Excel workbook
wb = Workbook()
ws = wb.active
ws.title = "Extracted Data"

# Extract headers
header_row = table.find("thead")
if header_row:
    headers = [th.get_text(strip=True) for th in header_row.find_all("th")]
    ws.append(headers)

# Extract data rows
tbody = table.find("tbody") or table
for row in tbody.find_all("tr"):
    cells = [td.get_text(strip=True) for td in row.find_all(["td", "th"])]
    if cells:
        ws.append(cells)

# Auto-fit column widths (approximate)
for col in ws.columns:
    max_length = max(len(str(cell.value or "")) for cell in col)
    ws.column_dimensions[col[0].column_letter].width = min(max_length + 2, 50)

# Save the file
wb.save("output.xlsx")
print("Saved output.xlsx with", ws.max_row - 1, "data rows")

Handling Complex Tables

Real-world HTML tables aren't always clean. Here's how to handle common complications:

# Handle colspan and rowspan
for row in table.find_all("tr"):
    for cell in row.find_all(["td", "th"]):
        colspan = int(cell.get("colspan", 1))
        rowspan = int(cell.get("rowspan", 1))
        # Merge cells in openpyxl if needed
        if colspan > 1 or rowspan > 1:
            ws.merge_cells(
                start_row=current_row,
                start_column=current_col,
                end_row=current_row + rowspan - 1,
                end_column=current_col + colspan - 1
            )

# Handle numeric conversion
def smart_convert(text):
    """Convert text to number if possible."""
    text = text.strip().replace(",", "").replace("$", "")
    try:
        return int(text)
    except ValueError:
        try:
            return float(text)
        except ValueError:
            return text

Pros

  • Full control over parsing, cleaning, and formatting.
  • Can scrape tables from any URL, not just pages you own.
  • Handles complex tables with merged cells, nested elements, and irregular structures.
  • Easy to automate for batch processing (e.g., scrape 100 pages and create one workbook).
  • openpyxl supports rich Excel formatting: colors, fonts, borders, conditional formatting, charts.

Cons

  • Requires Python and library installation (pip install beautifulsoup4 openpyxl requests).
  • Steeper learning curve for non-developers.
  • JavaScript-rendered tables require additional tools like Selenium or Playwright.
  • Need to handle edge cases manually (encoding, malformed HTML, dynamic content).

Best for: Automated, repeatable extraction from external websites or batch processing of multiple pages.

Method 5: Online Converters

Online conversion tools let you paste HTML or upload an HTML file and download the result as an Excel spreadsheet—no coding, no extensions, no installation.

How It Works

  1. Open an online HTML to Excel converter like ConvertMatrix's HTML to Excel tool.
  2. Paste your HTML table markup or upload an HTML file.
  3. Preview the parsed table to verify accuracy.
  4. Click "Convert" and download your .xlsx file.

Pros

  • No installation or setup required—works from any device with a browser.
  • Handles most standard HTML table structures automatically.
  • Visual preview lets you verify the conversion before downloading.
  • Some tools (like ConvertMatrix) process everything client-side, so your data never leaves your machine.
  • Accessible to non-technical users.

Cons

  • Server-based converters may upload your data—check privacy policies carefully.
  • Limited customization options compared to programmatic methods.
  • May struggle with very large tables or complex nested structures.
  • Not suitable for automated or recurring conversions.

Best for: Quick conversions by non-technical users who don't want to install anything.

Comparison Table

Method Difficulty Setup Required Automation Merged Cells Dynamic Tables Best Use Case
Copy & Paste Beginner None No Poor Yes (visible data) Quick one-off grabs
Browser Extensions Beginner Extension install Limited Varies Sometimes Regular extraction, no coding
SheetJS (JavaScript) Intermediate Library include Yes (client-side) Good Yes (DOM access) Adding export to your own apps
Python (BS4 + openpyxl) Advanced Python + pip Yes (full) Excellent With Selenium Batch scraping and processing
Online Converters Beginner None No Good No (HTML input only) Quick conversions, non-technical users

Which Method Should You Choose?

Your choice depends on three factors: frequency, complexity, and technical skill.

Choose Copy & Paste if…

You need data from a simple table once and don't mind spending a minute cleaning up the formatting in Excel.

Choose a Browser Extension if…

You regularly extract tables from different websites and want a point-and-click solution without writing code.

Choose SheetJS if…

You're building a web application and want to give your users a native "Download as Excel" button that works entirely in the browser.

Choose Python if…

You need to scrape tables from external sites on a schedule, handle complex HTML structures, or process hundreds of pages in a batch.

Choose an Online Converter if…

You have the HTML source of a table and want to convert it to Excel quickly without installing anything or writing any code.

Tips for Clean Conversions

Regardless of which method you choose, these tips will help you get better results:

  • Inspect the HTML first. Use your browser's DevTools (F12) to check for hidden rows, nested tables, or JavaScript-rendered content.
  • Watch for encoded characters. HTML entities like &amp;, &nbsp;, and &mdash; can appear as literal text if not decoded properly.
  • Handle numbers carefully. Values formatted as text (e.g., "1,234" with commas, or "$99.99" with currency symbols) won't be recognized as numbers in Excel without cleaning.
  • Check for colspan and rowspan. Merged cells in HTML may not translate directly to merged cells in Excel, causing misaligned data.
  • Verify dates. Date formats vary across locales. What looks like "01/02/2026" could be January 2nd or February 1st depending on the source.

Conclusion

Converting HTML tables to Excel doesn't have to be painful. For most users, an online converter or the copy-paste method gets the job done in seconds. Developers building web applications should reach for SheetJS for client-side exports or Python for server-side processing and scraping.

If you need a fast, reliable conversion without any setup, ConvertMatrix's HTML to Excel converter handles the heavy lifting for you. Just paste your HTML table markup, preview the result, and download a clean .xlsx file—all processing happens in your browser, so your data stays private.

Need to convert other formats too? Explore all ConvertMatrix tools for CSV, JSON, XML, YAML, and dozens of other format conversions—all free, all browser-based.

Try Our Free Conversion Tools

Put what you've learned into practice with our browser-based converters: