PortfolioBlogSnippets

Scraping HTML Tables with JavaScript

Have you ever tried to copy tables of data from web pages and paste them into spreadsheets? Sometimes, this can be difficult to accomplish manually. I wanted a quick, clean, and universal method for extracting HTML tables from web pages. Below, I linked to a JavaScript browser injection that scrapes every HTML table on a page and exports them to a csv. It has been tested on Linux & Windows workstations using the latest versions of Chrome & Firefox.

  1. Go to a webpage that contains at least one HTML table. You can use my List of LinkedIn Learning Certifications or W3 school's HTML Tables Examples if you need a page with HTML tables.
  2. Copy and paste the following snippet into the console view of your browser: Extract All Tables From Page
  3. Once you execute the script (just hit the "Enter" button), the tables will be extracted and saved as a CSV file.
  4. That's it, have fun!