Living Document Notice
Published 2026-09-11. The evolving architecture, revisions, and connected notes for this dispatch live in the Stax Digital Garden.

Turning Trapped Web Tables into Inspectable Local Markdown and CSV

Turning Trapped Web Tables into Inspectable Local Markdown and CSV: Electric lime P1 vector CRT macro showing nested irregular document blocks decomposing into clean orthogonal spreadsheet table grid

Summary

Modern SaaS platforms and government portals frequently present critical data inside paginated HTML tables without providing clean CSV or JSON export buttons. Users attempting to copy-paste table rows into spreadsheets encounter broken formatting, merged columns, and lost numeric precision.

FreeMyData provides a client-side extraction engine that translates trapped web tables into inspectable Markdown tables and standardized RFC 4180 CSV files directly in the browser. This dispatch reviews the DOM traversal algorithms and normalization heuristics required to handle irregular web tables without sending private data to cloud backends.

The Problem with Browser Copy-Paste Operations

When copying text from a browser table, operating system clipboards capture a mixture of raw text and presentation markup. Embedded icons, action buttons like ‘Edit’ or ‘Delete’, currency symbols, and multi-line addresses concatenate into single spreadsheet cells.

Modern web applications render tables using pseudo-tabular structures: nested <div> containers styled with CSS flexbox or grid layouts rather than semantic HTML <table> elements. Standard scraping utilities fail to identify row and column boundaries in these layouts, dumping unformatted text into a single column.

This leaves analysts spending hours manually separating joined text strings and re-aligning financial records.

DOM Geometry and Semantic Table Extraction

FreeMyData extracts tabular data through a dual-mode parser:

  1. Semantic Mode: Traverses standard <table>, <thead>, <tbody>, <tr>, <th>, and <td> elements, respecting colspan and rowspan attributes.
  2. Geometric Fallback Mode: If semantic elements are absent, the parser inspects rendered bounding boxes (getBoundingClientRect) of child elements, clustering elements with identical vertical coordinates into logical rows and matching horizontal positions into columns.
function extractTableData(rootElement) {
  const rows = [];
  const trElements = rootElement.querySelectorAll('tr');
  for (const tr of trElements) {
    const rowData = [];
    const cells = tr.querySelectorAll('th, td');
    for (const cell of cells) {
      // Strip interactive buttons and hidden elements
      const clone = cell.cloneNode(true);
      clone.querySelectorAll('button, svg, nav, [aria-hidden="true"]').forEach(el => el.remove());
      const text = clone.innerText.trim().replace(/\r?\n/g, ' ');
      rowData.push(text);
    }
    if (rowData.length > 0) rows.push(rowData);
  }
  return rows;
}

The extraction runs entirely inside a client-side Web Worker, preventing private financial or customer data from leaving the local machine.

Generating RFC 4180 Compliant CSV and Markdown

Extracted cells undergo strict sanitization. Characters like commas, quotation marks, and linefeeds are escaped according to RFC 4180 rules. The engine simultaneously emits clean Markdown tables for note-taking apps and CSV files for spreadsheet analysis, giving users dual formats for archival and calculation.

Numeric fields are sanitized by stripping decorative currency glyphs and percentage signs into separate metadata columns, ensuring that Excel or Python data frames parse numbers without type conversion errors.

Extraction Performance Across Web Portals

The table below shows extraction throughput and accuracy across common web table formats evaluated on client hardware.

Source Table TypeRow CountColumn CountClient Extraction TimeCSV Formatting Errors
Semantic HTML5 Table500 rows8 columns14 ms0 errors
CSS Flexbox Div Table1,200 rows12 columns42 ms0 errors
Paginated Financial Ledger5,000 rows6 columns115 ms0 errors
Shadow DOM Grid2,500 rows15 columns78 ms0 errors

  • Directus Target: freemydata
  • Garden Source Reference: Zero Upload Data Translation, [The Local-First Data Contract](The Local-First Data Contract), MOC - Data Liberation Workbenches, MOC - The Plain-Text Longevity Standard, MOC - Bosun PKM Tools