Chrome DevTools: How to Copy Table as CSV (3 Methods)

Developers often ask: "How can I use Chrome DevTools to copy a table as CSV?" While it is possible to write JavaScript in the console to extract data, it's often faster and more accurate to use a dedicated tool. This guide covers both the "Hacker Way" (Console) and the "Pro Way" (Extension).

Method 1: The "Hacker Way" (Chrome Console)

If you are comfortable with JavaScript, you can extract table data directly from the Console tab.

Step 1: Open DevTools

Press F12 or Ctrl+Shift+I to open Chrome DevTools.

Step 2: Run Extraction Script

Paste this code into the Console to get a basic CSV output:

var csv = [];
var rows = document.querySelectorAll("table tr");
for (var i = 0; i < rows.length; i++) {
    var row = [], cols = rows[i].querySelectorAll("td, th");
    for (var j = 0; j < cols.length; j++) 
        row.push('"' + cols[j].innerText.replace(/"/g, '""') + '"');
    csv.push(row.join(","));
}
console.log(csv.join("\n"));

Why this fails

  • ❌ Merged Cells: Doesn't handle rowspan or colspan.
  • ❌ Nested Tables: Breaks if tables are inside tables.
  • ❌ Pagination: Only exports the visible page.
  • ❌ Encoding: Might mess up special characters (UTF-8).

Method 2: The "Pro Way" (Table to Excel Extension)

For a reliable, one-click solution that handles all edge cases (merged cells, images, links), use the Table to Excel extension.

  1. Install Table to Excel from the Web Store.
  2. Hover over any table on the page.
  3. Click "CSV" in the floating menu.
Table to Excel extension showing export buttons

Why it's better

  • ✅ Accurate: Preserves table structure perfectly.
  • ✅ Fast: No coding required.
  • ✅ Safe: Runs locally in your browser.
  • ✅ Powerful: Handles CSS Grid and Div-based tables.

Method 3: copy(object) Command

Chrome has a built-in copy() function.

  1. Inspect the table element.
  2. Right-click the <table> tag > "Store as global variable" (usually saves as temp1).
  3. Run copy(temp1.outerHTML) to copy the HTML.
  4. Paste into Excel (it will paste as HTML, not CSV).

Comparison

Feature Chrome Console Table to Excel
Ease of Use Hard (Code) Easy (1-Click)
Merged Cells ❌ Fails ✅ Preserved
Large Tables ⚠️ Laggy ✅ Fast

Stop Writing Scripts. Start Exporting.

Save hours of manual work with the professional tool.

⬇️ Add to Chrome — Free