How to copy notion tables

  • by Amando Abreu
  • on 19 June 2023

A pet peeve of mine is when someone shares a table of some content that I want to save, but it’s on notion, and seemingly impossible to copy.

So I made this javascript file.

Open up the console and paste away!

Before running the code, make sure the entire table is visible. You might need to scroll all the way to the bottom of the table and click “Load more” a few times.

let rowElements = document.querySelectorAll('.notion-selectable.notion-page-block.notion-collection-item');
let rows = [];

rowElements.forEach((rowElement, rowIndex) => {
  // Get top level div elements (direct children of rowElement)
  let cellElements = Array.from(rowElement.children);
  let row = {};

  cellElements.forEach((cellElement, cellIndex) => {
    // Get all nested div elements within the cell
    let nestedDivs = Array.from(cellElement.querySelectorAll('div'));

    // Concatenate the textContent of all nested divs
    let cellText = => div.textContent.trim()).join(' ');
    row[`Cell ${cellIndex + 1}`] = cellText;

  // Only add rows that have at least one cell
  if (Object.keys(row).length > 0) {


This code will output a table you can copy/paste into excel, csv, etc.

About the author

Amando Abreu is a serial entrepreneur, Fractional CTO, and engineer who has been involved in several startups and launched dozens of products. He has worked with companies such as trivago, Portugal Telecom, and Vizrt. He has experience in several industries, most notably e-commerce, SaaS, media, travel, insurance, property development, and construction.
No comments, just