Qiaohua Ruan
← All guides

How to Export an HTML Table to Excel or CSV

You can see the table on the page. You want it in Excel, or as a CSV you can open later. Sometimes a simple copy and paste is enough. Other times the paste lands in one column, Excel’s “From Web” finds nothing, or a Google Sheets formula comes back empty.

The methods below start with no extra tools. Move down only when the previous one fails.

Copy and paste, then paste as text if the formatting breaks

For a small, ordinary HTML table, this is still the fastest path.

  1. Click just before the first cell and drag to the last cell. Avoid grabbing the site header or a sidebar.
  2. Copy it (Ctrl+C on Windows, Cmd+C on a Mac).
  3. Click a cell in Excel or Google Sheets and paste (Ctrl+V / Cmd+V).

If the grid and the numbers look right, you are done. Save as an Excel workbook (.xlsx) or CSV from File → Save As, or from File → Download in Google Sheets.

When the result looks wrong, do not retype the table:

  • The page’s fonts, colors, or merged header cells come along. In Excel, undo and use Paste Special → Text (or “Match Destination Formatting”). In Google Sheets, try Edit → Paste special → Values only.
  • Everything lands in one column. The data may have arrived as plain text. In Excel, select that column, open Data → Text to Columns, and split on tabs or commas. If it is still a jumble, the “table” on the page may not be a real <table> — skip to DevTools or a converter.
  • You only got the rows that were on screen. Many dashboards render just the visible slice of a long grid. If new rows replace the old ones as you scroll, copy-paste cannot see the rest.

Copy-paste is a snapshot: if the page changes, you copy it again.

Use Excel’s Data → From Web when the page is public

Excel for Windows (Microsoft 365, or Excel 2016 and later) can fetch a page and list the HTML tables it finds, using the web connector. Use it when the table is on a public URL and you may want to refresh it later.

  1. Open a workbook and go to the Data tab.
  2. Click From Web. In some versions the path is Get Data → From Other Sources → From Web.
  3. Paste the page address and confirm. For a public page, choose Anonymous if Excel asks how to sign in.
  4. In the Navigator, pick the table whose preview matches, then Load. If the first row is still a header sitting in the data, use Transform Data and Use First Row as Headers.

The query remembers the URL. Later, Data → Refresh All pulls a fresh copy. To get a CSV, use File → Save As → CSV; Excel will remind you that only the current sheet is written.

Two limits matter. This connector is a Windows feature; Excel for Mac and Excel for the web do not offer the same path. And Excel reads the HTML the server sends, so a table built by JavaScript, or shown only after login, often leaves the Navigator empty.

Use Google Sheets’ IMPORTHTML for the same kind of public page

If you do not have desktop Excel, or you want the table in a shared sheet, Google Sheets can do a similar fetch:

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

The first argument is the full page address, including https://. The second is "table" (use "list" for a bulleted or numbered list). The third is the table index: 1 is the first <table> in the HTML, 2 the second, and so on. Navigation boxes and hidden layout tables count, so the table you see may not be number 1. If you get the wrong block, increase the index.

The first time a sheet uses an import formula, Sheets may ask an editor to allow access to external data.

Google’s documentation describes IMPORTHTML as a live import; the sheet refetches from time to time while it is in use. For a fixed copy, select the range, copy it, and use Edit → Paste special → Values only, then File → Download.

IMPORTHTML has the same wall as Excel’s From Web: Google’s servers fetch the page, they do not run its scripts, and they cannot log in as you. A #N/A with “could not fetch URL” or “imported content is empty” usually means the table is not in the raw HTML. Confirm that with View page source (not Inspect) and a search for <table. If it is missing there, changing the index will not help.

Copy the rendered table from DevTools

This free method still works when From Web and IMPORTHTML fail. It reads the table *after* JavaScript has run, on the page you already have open — including pages behind a login.

If you want it in Excel or Sheets immediately:

  1. Right-click inside the table and choose Inspect.
  2. In the Elements panel, select the <table> node. If the highlight is on a <td> or <div>, walk up the tree until you are on the <table>.
  3. Right-click that node → Copy → Copy element.
  4. Paste into Excel. Excel can parse an HTML table from the clipboard and keep the rows and columns. If you get raw markup instead, paste into the HTML table converter on this site and download Excel or CSV from there.

If you want a clean CSV on the clipboard:

Select the <table> in Elements so it becomes $0, open the Console, and run:

const csv = [...$0.rows].map(row =>
  [...row.cells].map(cell =>
    '"' + cell.innerText.replaceAll('"', '""').replaceAll(/\r?\n/g, ' ') + '"'
  ).join(',')
).join('\n');
copy(csv);

Paste into a text editor and save it as .csv, or paste into a sheet and use Text to Columns if needed. $0.rows only exists on a real <table>. If the inspector shows a stack of <div>s that merely look like a grid, this snippet will error; use a converter or an extension that can read some non-table grids.

DevTools still only sees rows that exist in the page. A virtualized grid that unloads rows as you scroll will not give you the full dataset.

Paste the table into a converter in your browser

If you can copy the table, or you already have the HTML, you do not need to upload it to a conversion website. This site has a HTML table to CSV / Excel converter that runs in your browser: paste the copied table or the markup, preview the rows, and download CSV, TSV, or an .xlsx file. The paste never leaves your computer.

Use this when paste-into-Excel keeps the page’s styling, when you want a UTF-8 CSV that Excel on Windows is more likely to open correctly, or when long IDs should stay as text. The page cannot fetch a URL you type in — browsers block that — so you still copy the table yourself.

A Chrome extension, if you do this often

The methods above are enough for a one-off table. If you export tables most days, a browser extension can read the table already on the screen, which is why it also works on JavaScript-heavy and logged-in pages.

Table to Excel & CSV is the extension this site makes. It lists the tables it finds on the current page, highlights one when you hover, and can copy TSV or download CSV or Excel. Work stays in the browser; the table is not uploaded. The free tier exports up to 500 rows per file, and long numbers or leading zeros are kept as text. The Chrome Web Store listing is still under review, so it is not a one-click install today. Until it is, use the converter and the DevTools steps above.

No extension can invent rows the page has not rendered. If a grid only paints the visible window, you still have to work within that limit, or look for an official export.

Which method should you use?

SituationStart with
A short, public table you need onceCopy and paste (paste as text if styling gets in the way)
A public page you want to refresh later, on Excel for WindowsData → From Web
The same, but you work in Google SheetsIMPORTHTML
The table is built by JavaScript, or sits behind a loginDevTools, or the in-browser converter after you copy the table
You do this often, including some grids that are not a <table>An extension that reads the page in front of you

Any of these methods can end as a CSV, once you have a clean grid.

Frequently asked questions

Why does a pasted table end up in one column?

Either the paste arrived as plain text, or what looks like a table on the page is a layout of <div>s. Try Paste Special → Text and Text to Columns. If the inspector does not show a <table>, use the converter or an extension that can read some grid layouts.

Why does Excel From Web or IMPORTHTML find no table?

Both tools fetch the page from a server and never run the page’s JavaScript. They also cannot use your login cookie. Check View page source. If the table is missing there, switch to DevTools or a tool that reads the rendered page.

How do I keep long IDs and leading zeros from breaking in Excel?

Treat them as text, not numbers. Excel’s 15-digit precision will otherwise round a long order ID or display it as 1.23E+17, and 00123 becomes 123. An .xlsx file that writes those cells as text avoids this. A CSV cannot mark a cell type the same way, so import it through Data → From Text/CSV and set those columns to Text.

Will a UTF-8 CSV open correctly in Excel on Windows?

Often not, if you double-click the file. Excel may assume a legacy encoding and garble non-English text. A UTF-8 byte order mark at the start of the file helps; the converter on this site writes that mark on CSV downloads. You can also use Data → From Text/CSV and choose UTF-8, or skip CSV and download an Excel workbook.

Can I export a table from a page I have to sign in to?

Yes, but not with From Web or IMPORTHTML. Stay on the page in your browser and use copy-paste, DevTools, the converter after a copy, or an extension that reads the current tab.

Is this affiliated with Microsoft Excel?

No. “Excel” here means the common .xlsx format and the Microsoft Excel application.