October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
Excel Power Query

How to Extract a Table from a Web Page

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a one-time job, select a visible table on the page, copy it, and paste it into a spreadsheet. For repeatable imports, use Google Sheets’ IMPORTHTML, Excel’s Power Query web connector, or Python’s pandas.read_html. The right method depends on how the site serves its content and what tools you use; none is guaranteed to work on every page. Whichever method you choose, check the extracted headers, row count, and sample values against the source before relying on the data.

Choose a method that fits the page and your workflow

First decide whether you need the data once or want an import you can repeat. Then consider whether the page contains a regular HTML table or only content that looks tabular. A screenshot or visual layout is not itself structured table data, and a site may serve content in a way a particular importer cannot access.

Method Best fit What you get
Copy and paste A one-off extraction from a table visible in your browser Cells pasted into a spreadsheet; review for omissions or layout artifacts.
Google Sheets IMPORTHTML A short formula-based import in Sheets A page table or list, selected by a one-based index.
Excel Power Query An Excel workflow where you want to preview, transform, and load a detected table A selectable table preview, or an example-based extraction when the target is not a tidy detected table.
Python pandas A Python workflow that needs parsed tables as DataFrames A list of DataFrames to inspect and process.

There is no universally best choice established for every site. If the task is simply moving one visible table, start with copy and paste. If you will refresh or process data, choose the spreadsheet or Python tool already in your workflow.

Copy a visible table into a spreadsheet

  1. Open the page in a browser and locate the table.
  2. Select the table’s cells, including the header row if you need the labels.
  3. Copy the selection, then paste it into a blank spreadsheet cell.
  4. Inspect the pasted result for missing rows, shifted columns, merged cells, or other layout artifacts.

For a one-off task, this avoids setting up an importer. The result depends on what the browser can select and copy as tabular content, so do not assume that a visually aligned page will paste into clean columns.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If you want to read copied tabular clipboard content in Python, pandas also documents read_clipboard(), which parses clipboard content through its CSV reader. See the pandas I/O documentation for the clipboard and HTML-reading interfaces.

Import a web table into Google Sheets

In a Google Sheets cell, enter a formula in this form:

=IMPORTHTML("https://example.com/page","table",1)

Replace the example address with the page URL and use the table’s position on that page. Google documents the function as IMPORTHTML(url, query, index). The query is either "table" or "list"; the index starts at 1, not 0. Table and list positions are counted separately. See Google’s IMPORTHTML help for the function details.

Pick the right index

If the page has multiple tables, try the one-based position for the table you want. A page’s first table uses index 1. If you are querying lists instead, list positions use their own count; they do not take up table indices. Inspect the returned data rather than assuming the first table-like item is the target.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option

When the formula does not return the expected content

The page must expose the relevant content in a form Sheets can import. If the result is the wrong table, check the index and whether you used "table" rather than "list". If it returns no useful result, the page may not present the content in a form this importer can retrieve; the documentation does not establish a universal fix for every site.

Use Excel Power Query to preview and load a web table

  1. In Excel, choose Data > From Web and enter the page URL.
  2. When Navigator opens, inspect the detected tables and their previews.
  3. Select the table whose headers and sample rows match the page.
  4. Choose Transform Data to inspect or adjust the query before loading, or choose Load to put the result into Excel.

Microsoft describes the Web connector as part of an Office 365 subscription; interface availability can vary with edition and update state. The connector’s Navigator can show detected tables and preview a selection. See Microsoft Learn’s Power Query Web Connector documentation and Microsoft Support’s web connector instructions.

If Navigator does not find the table

When the desired content is not a tidy detected table but has consistent structure, Microsoft documents Add table using examples: provide sample values so Power Query can identify matching content. This is an alternative to selecting a detected table, not a guarantee that every page can be extracted. The steps and availability are described in Microsoft’s guide to getting web page data by providing examples.

Power Query Online has a gateway requirement

For Power Query Online, Microsoft says its Web Page connector requires an on-premises data gateway for security reasons because it retrieves HTML using a browser control. Microsoft distinguishes this from the Web API connector, which does not use that control. This requirement applies to the Online connector scenario; do not treat it as a general requirement for every desktop Excel import.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Read HTML tables in Python with pandas

pandas.read_html accepts a URL, HTML string, or file and returns a list of DataFrames—even when the page contains only one table. Inspect the list and choose the DataFrame that corresponds to the table you need:

import pandas as pd
tables = pd.read_html("https://example.com/page")
print(f"Found {len(tables)} tables")
for i, table in enumerate(tables):
    print(f"Table {i}:")
    print(table.head())

# After inspecting the previews, select the intended table.
df = tables[0]
print(df)

The index in this Python list is zero-based, unlike Google Sheets’ one-based IMPORTHTML index. The example prints every table’s first rows so you can identify the target before assigning it to df; change tables[0] if another result is the right one. Read the pandas I/O documentation for the supported inputs and HTML table parsing guidance.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers

Expect markup and parser differences

Parsing depends on the page’s HTML and parser behavior. pandas explicitly points readers to its HTML table parsing gotchas, so malformed or unusual markup can produce unexpected results. Do not treat a successful function call as proof that the DataFrame is complete or correct.

Verify the extracted result before using it

Extraction is only useful if the resulting rows and columns represent the source table. Compare the output with the page before analysis, reporting, or publication:

  • Headers: Check that each expected column appears and that labels are in the right order.
  • Row completeness: Compare the first and last visible records and check whether expected rows are missing.
  • Representative values: Match several values from different parts of the table, not just the first row.
  • Structure: Look for shifted columns, repeated headers, merged-cell effects, or values that have landed in the wrong field.

If the output does not match, return to the source page and check the selected table or index before building anything on top of it.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common extraction problems

The spreadsheet imported the wrong table

In Sheets, verify the IMPORTHTML query and one-based index. Remember that table and list indices are maintained separately. In Power Query, compare the Navigator preview with the target page before loading; a page may expose several detected tables.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Power Query shows no suitable detected table

Inspect the page and try Microsoft’s example-based extraction when the desired content is consistently structured but is not represented as a tidy detected table. If the page does not provide content the connector can retrieve, the available documentation does not support a universal workaround.

pandas returns several DataFrames

That is expected: read_html returns a list even for a single table. Print the number of results and preview each one, then select the matching DataFrame instead of assuming the first entry is correct.

An import fails or returns incomplete content

Inspect the page and check whether its supported data or API options offer a better route. A page can be authenticated, dynamically rendered, or otherwise unavailable to the importer being used, but there is no universal remedy established for those cases. No particular target page is guaranteed by these general workflows; the page and chosen tool matter.

Or skip the browser setup

If your goal is to save a visual record of a page alongside extracted data, ScreenshotNeo is a screenshot API and MCP server, not a table parser: it captures a page as PNG, JPEG, WebP, or PDF. One GET request can capture a URL:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com/page -o shot.webp

See the ScreenshotNeo API documentation for request options. Cookie banners, popups, and chat widgets are removed before the shot; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots. The Free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000. Sign up for 1,000 free screenshots a month with no card.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

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

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Read next

Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.