Ordelio

How to save a table from a web page as a CSV file

A CSV file is plain text that every spreadsheet and database can read. Getting a web table into one is easy; getting it in without garbled accents, a wrong separator or lost zeros is the hard part. Four ways, and where each one trips.

1. Copy, paste into Excel, then Save As

Select the table, copy it, paste it into a blank Excel sheet, then use the Save As command in the File menu and choose the file type CSV UTF-8.

Good for: a small table you need once, when you already have Excel open.

Where it breaks: choose the plain CSV type instead of CSV UTF-8 and every character outside your Windows code page (accents, Cyrillic, Chinese) turns into a question mark. Excel also writes the separator set in your Windows regional settings, so on many European systems your "comma-separated" file is actually separated by semicolons, and the program that reads it may expect commas. Pasting can also drop leading zeros (a code like 01234 becomes 1234) and turn values such as 1-2 into dates, and the selection may grab text around the table.

2. Google Sheets: paste, then Download

Paste the table into a Google Sheets file, then open the File menu, then Download, and choose the comma-separated values (.csv) format.

Good for: any computer with a browser, no Excel needed, and the file is always UTF-8.

Where it breaks: the file always uses commas, which Excel in a region with a decimal comma may not split into columns when you double-click it. Only the sheet you are looking at is downloaded, not the whole file. Like Excel, Sheets may convert some values into dates or numbers while pasting.

3. Python: pandas.read_html

If you already work in Python, pandas reads every table on a page and writes one to CSV:

pandas.read_html("https://example.com/page")[0].to_csv("table.csv", index=False)

The number in brackets is the position of the table on the page (0 for the first). You need pandas and lxml installed.

Good for: the same page every week, or hundreds of pages, in a script.

Where it breaks: some sites refuse the request with an error 403 because it does not look like a browser, so you have to download the page yourself and pass the HTML to pandas. It cannot see pages behind a login or tables that JavaScript draws after the page loads. Footnote marks such as [1] stay in the headers and values, and whole numbers can come out as 8021407192.0 once a column has a missing cell.

4. A browser extension: one click on the page you are reading

An extension works on the page exactly as you see it in your browser, so it also works after you log in and on tables built with JavaScript. We make one, Ordelio Table Copy (free, no row limits):

  1. Open the page and click the extension icon (or press Alt+Shift+Y). It lists every table on the page, the biggest first; hover one and it lights up.
  2. Press CSV: the browser saves a file with that table. Accents survive because the file is UTF-8 with a mark that tells Excel so, and the separator is a semicolon where your language writes decimals with a comma (you can force a comma, semicolon or tab in the options).

It also removes footnote marks like [1], repeats merged cells so columns stay aligned, and writes codes like 01234 into the file exactly as they are on the page (a spreadsheet that opens the file may still turn them into numbers).

Where it breaks: it saves what is on the page now, so a table split across several pages needs one file per page, and it cannot update the file by itself like a script can.

Get Table Copy for Microsoft Edge Chrome and Firefox versions: in review.

Which one to use

Excel Save AsGoogle SheetspandasExtension
Pages behind a loginYes (by copying)Yes (by copying)NoYes
Accents come out rightOnly with CSV UTF-8YesYesYes
Separator you can chooseNo (set by Windows)No (always commas)Yes (a parameter)Yes (an option)
Hundreds of pages in one goNoNoYesNo
Time for one new pageAbout a minuteAbout a minuteMinutes, the first timeA few seconds

In short: for a script that runs every week on public pages, use pandas. For a one-off from a page you are reading, especially behind a login, save it straight from the page.

Found a table that none of these methods handles? Tell us, we read every message.