ScreenshotNeo

BlogHow-to

How to Make an HTML Grid Export Cleanly to Excel

Import an HTML grid into Excel, fix merged columns and encoding, choose CSV or HTML export, and preserve the data that matters.

By the ScreenshotNeo team1 October 20269 min read

How to Make an HTML Grid Export Cleanly to Excel

Short answer: For a live webpage, use Excel’s Data → From Web connector, select the intended table in Navigator, clean it in Power Query, and load it into a worksheet. For a saved .html file, use Excel’s file-import workflow. Keep an .xlsx master when formulas, charts, PivotTables or VBA matter; use CSV or tab-delimited text only for simple data exchange.

This guide covers both meanings of “export an HTML grid to Excel”: importing a grid from a webpage or file into Excel, and exporting Excel data as CSV, tab-delimited text or HTML.

1. Decide which direction you need

Goal Recommended route What to expect
Webpage to worksheet Data → From Web Excel uses Power Query to detect tables, preview them and load or transform the result.
Saved HTML file to worksheet Data → Get Data → From File Choose the local file, select the detected data and destination.
Simple rows and columns for another system CSV or tab-delimited text Portable data exchange; delimiters and regional settings affect parsing.
Web-page representation of a workbook HTML or MHTML Presentation format with feature loss; it is not an .xlsx backup.

2. Import a live HTML grid with From Web

  1. Open desktop Excel and choose Data → From Web (some versions show Data → Get Data → From Other Sources → From Web).
  2. Enter the page URL and continue. The web connector uses Power Query and requires internet access; the newer connector experience requires an Office 365 subscription.
  3. In Navigator, inspect every detected table. Select the table containing the grid’s header and rows, then preview it.
  4. Choose Transform Data to remove page headings, blank rows or unwanted columns before loading. Choose Load when the preview is already clean.
  5. Set the destination worksheet and review the resulting column types.

Microsoft documents the connector workflow and refreshable connections in Import data from the web using the web connector. A page can expose several candidate tables, so selecting the correct Navigator item is the key step.

A web table is detected, shaped in Power Query and loaded into Excel.
A web table is detected, shaped in Power Query and loaded into Excel.

Power Query cleanup checklist

  • Promote the first real row to headers if Excel treats a title as the header.
  • Remove repeated header rows inserted between groups.
  • Delete empty columns created by layout cells.
  • Trim leading and trailing spaces from text columns.
  • Replace non-breaking spaces and line breaks inside cells.
  • Set dates, whole numbers, decimals and identifiers to deliberate data types.
  • Split combined fields only when the separator is stable.
  • Filter subtotal or navigation rows that are not records.
  • Use Close & Load after previewing the transformed result.

3. Import a saved HTML file

Save the page as .html or .htm, then import that file instead of entering a URL. On the Mac versions covered by Microsoft’s support article (Microsoft 365 for Mac, Excel 2024 for Mac and Excel 2021 for Mac), use Data → Get & Transform Data → Get Data → From File, choose the file, select Import, and choose the table and destination. Follow the equivalent From File path on other versions.

See Microsoft’s platform-specific procedure in Import data from a CSV, HTML, or text file. Always inspect the imported preview: arbitrary page layout, nested tables and visual grids may not map to one rectangular table.

4. Make the HTML grid easier for Excel to detect

If you control the HTML, use a semantic table. Keep one header row in <thead>, records in <tbody>, and one value per <td>. Avoid using nested tables for layout, empty cells for spacing, or merged cells that carry multiple meanings.

<table id="orders">
  <thead>
    <tr><th scope="col">Order ID</th><th scope="col">Customer</th><th scope="col">Total</th></tr>
  </thead>
  <tbody>
    <tr><td>1001</td><td>Ada Lovelace</td><td>125.00</td></tr>
    <tr><td>1002</td><td>Grace Hopper</td><td>89.50</td></tr>
  </tbody>
</table>

For generated grids, render the complete rows in the HTML source or provide a server-side export. A virtualized grid may display only the visible rows in the DOM, leaving Excel with an incomplete table.

5. Fix “everything pasted into one column”

  1. Prefer Data → From Web over copying the visual grid. It lets Excel detect the table structure.
  2. If you already have text, use Data → Text to Columns and choose the actual delimiter (comma, tab, semicolon or another character).
  3. Check whether the source puts commas, tabs or line breaks inside quoted fields. A parser must honor quoting.
  4. Verify regional settings. A comma decimal separator and semicolon list separator can change how Excel interprets the same text.
  5. For a repeatable process, load the source through Power Query and document the delimiter and type conversions.

6. Repair garbled characters and wrong data types

Characters such as é, € or non-Latin scripts can appear corrupted when the source encoding and Excel’s interpretation differ. Check the page’s declared encoding and use Excel’s Web Page Options to select the matching character set; preview the result rather than assuming one encoding works for every site. Microsoft describes these controls in Web Page options.

Also check automatic type conversion. Product IDs with leading zeroes, long numeric identifiers and dates can be changed when Excel guesses their types. In Power Query, set those columns to Text before loading.

7. Export Excel data as CSV, tab-delimited text or HTML

CSV and tab-delimited text

Use File → Save As and select CSV or a text format when the destination needs rows and columns only. Confirm the delimiter, text qualifier and regional interpretation in the receiving application. Microsoft’s text import and export guidance covers these formats. Excel documents a maximum of 1,048,576 rows and 16,384 columns for its text import/export workflow.

CSV and tab-delimited files do not preserve workbook formulas, charts, PivotTables, VBA projects or layout. Retain the original .xlsx file when those features matter.

HTML or MHTML

Excel can save supported workbook content as .htm/.html or single-file .mht/.mhtml. These are useful when another system needs a web-page representation. They are not full-fidelity workbook formats: formulas, charts, PivotTables and VBA projects are not supported and can be lost when the file is reopened. See Microsoft’s Saving Documents as Web Pages and the supported file formats reference.

8. Do-it-yourself automation examples

For recurring exports, generate a rectangular HTML table first, then hand it to Excel or a downstream parser. This minimal Python example writes a standards-compliant HTML file from rows:

from html import escape

rows = [
    ("1001", "Ada Lovelace", "125.00"),
    ("1002", "Grace Hopper", "89.50"),
]

with open("orders.html", "w", encoding="utf-8") as f:
    f.write("<meta charset='utf-8'><table><thead>")
    f.write("<tr><th>Order ID</th><th>Customer</th><th>Total</th></tr>")
    f.write("</thead><tbody>")
    for order_id, customer, total in rows:
        f.write("<tr>" + "".join(f"<td>{escape(v)}</td>" for v in (order_id, customer, total)) + "</tr>")
    f.write("</tbody></table>")

Open the resulting file in Excel through the HTML file-import workflow, then set identifier columns to text.

9. Or skip the browser setup

If the grid is on a page and you need a reliable visual capture before documenting or reviewing it, ScreenshotNeo provides a one-request screenshot API. Its clean-shot steps accept cookie and consent banners and remove more than 60 known consent platforms, newsletter popups and chat widgets before capture; each step can be disabled. Bot checks, blank pages, timeouts, failed loads and cache hits are not billed, and response headers report the page verdict and billing result.

Consent banners and overlays can obscure the grid before capture.
Consent banners and overlays can obscure the grid before capture.

See the ScreenshotNeo API documentation for all options, including full-page capture, CSS element selection, custom CSS and JavaScript, waits, request blocking, headers, cookies, user agents, timezone, geolocation, resizing, caching, signed links, asynchronous jobs, bulk capture and PDF output.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

ScreenshotNeo also includes an MCP server for Claude, Cursor and other MCP clients, so AI agents can call take_screenshot, get_page_info and capture_pdf. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.

10. Troubleshooting

Symptom Likely cause Fix
No tables appear in Navigator JavaScript-rendered or virtualized grid, login wall, or unsupported layout Use a server-rendered table or export endpoint; authenticate where supported; save the rendered page and import the file.
Wrong table selected Several tables are present, including navigation or layout tables Preview each Navigator item and choose the one with the expected headers and row count.
Headers repeat as data Grouped HTML contains header rows inside the body Filter those rows in Power Query, then promote the real header once.
All values are in one column Delimiter mismatch or copy/paste from a visual grid Use From Web, or Text to Columns with the source delimiter and quoting rules.
Accented characters are broken Encoding mismatch Match the source encoding in Web Page Options and preview before loading.
Leading zeroes disappear Excel inferred a numeric type Set the column to Text in Power Query before loading.
Dates swap month and day Locale mismatch Parse the column with the source locale and verify several known dates.
Rows are missing Infinite scroll or client-side pagination Use an endpoint that returns all rows, disable pagination, or capture each page deliberately and combine results.
Formatting is missing after CSV export CSV contains values, not workbook presentation Keep an .xlsx master and use CSV only for interchange.

11. Performance, reliability and cost considerations

  • Performance: Filter and select columns in Power Query before loading large tables. Avoid repeated manual copy/paste. For very large data, extract from the source system rather than a rendered page.
  • Reliability: A refresh depends on the page URL, authentication, HTML structure and network availability. Save a source snapshot or retain the last successful workbook when auditability matters.
  • Excel limits: Plan around the documented 1,048,576-row and 16,384-column limits for text import/export.
  • Format choice: CSV and tab-delimited text are compact and broadly interoperable but lose workbook features. HTML preserves a web representation, not full Excel behavior. .xlsx is the preservation copy.
  • ScreenshotNeo cost: Clean shots only are billed; bot checks, blank pages, timeouts, failed loads and cache hits cost nothing. Plans are Free (1,000/month), Starter $5/3,000, Growth $15/15,000, Pro $39/60,000, Scale $99/250,000 and Business $249/1,000,000; yearly billing gives two months free.

12. FAQ

Can I import an HTML table without opening it in a browser?

Yes. Save the page as an HTML file and use Excel’s From File import path, or provide the URL directly to From Web.

Why does Excel show several tables?

Pages often contain multiple detectable tables for navigation, layout and data. Use Navigator previews to identify the table with the intended headers and records.

Should I use CSV or HTML for a data feed?

Use CSV or tab-delimited text for simple row and column exchange. Use HTML when the receiving system needs a web-page representation. Keep .xlsx for workbook features.

Will exporting to HTML preserve formulas and macros?

No. Microsoft documents that formulas, charts, PivotTables and VBA projects are not supported in HTML/MHTML export and may be lost.

How do I preserve product codes such as 00123?

Set the column to Text in Power Query before loading, or use a text import configuration that does not infer numeric types.