Skip to content

Instantly share code, notes, and snippets.

@jamesmurdza
Last active May 22, 2022 07:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesmurdza/dc4835719af03b3754aad51c37a4414c to your computer and use it in GitHub Desktop.
Save jamesmurdza/dc4835719af03b3754aad51c37a4414c to your computer and use it in GitHub Desktop.
Turn any webpage into a spreadsheet

Turn any webpage into a spreadsheet

YouTube Video
Follow this walk-through in video format

Instructions

  1. Install the SelectorGadget Chrome extension.

  2. On the target site, activate SelectorGadget from the toolbar. Click on any elements to select it. It will turn green. Similar elements will be autoselected and turn yellow. Click on yellow items to deselect them and turn them red. This is a trial-and-error process.

  3. When all the items you want to copy have turned yellow, open the developer console (command+option+J on macOS or control+shift+J on Windows or Linux). Use one of the commands below to copy the selection to the clipboard:

Copy a list of text cells:

copy([...document.querySelectorAll("SELECTOR")].map(item=>item.innerText).join("\n"))

Copy a list of image URLs:

copy([...document.querySelectorAll("SELECTOR")].map(item=>item.src).join("\n"))

Copy a list of link URLs:

copy([...document.querySelectorAll("SELECTOR")].map(item=>item.href).join("\n"))

Replace SELECTOR in the command with the selector given by SelectorGadget.

  1. After running the command, paste the results (command+V on macOS or control+V on Windows or Linux) into the right column in your sheet.

  2. Repeat 3-4 for each set of elements that you need, filling in your sheet!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment