<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jessy Shen</title>
    <description>The latest articles on DEV Community by Jessy Shen (@jessyshen).</description>
    <link>https://dev.to/jessyshen</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4113444%2Fa0b56206-303b-45f2-82d4-86dc6c353736.png</url>
      <title>DEV Community: Jessy Shen</title>
      <link>https://dev.to/jessyshen</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jessyshen"/>
    <language>en</language>
    <item>
      <title>Exporting a table that is not a table: React, AG Grid and other div grids</title>
      <dc:creator>Jessy Shen</dc:creator>
      <pubDate>Mon, 07 Sep 2026 08:02:55 +0000</pubDate>
      <link>https://dev.to/jessyshen/exporting-a-table-that-is-not-a-table-react-ag-grid-and-other-div-grids-k5a</link>
      <guid>https://dev.to/jessyshen/exporting-a-table-that-is-not-a-table-react-ag-grid-and-other-div-grids-k5a</guid>
      <description>&lt;h1&gt;
  
  
  Exporting a table that is not a &lt;code&gt;&amp;lt;table&amp;gt;&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;The symptom is always the same. You are looking at something that is&lt;br&gt;
unmistakably a table, with headers and rows and sortable columns, and the tool&lt;br&gt;
you reached for says there is no table on this page.&lt;/p&gt;
&lt;h2&gt;
  
  
  Why it happens
&lt;/h2&gt;

&lt;p&gt;Modern data grids do not use &lt;code&gt;&amp;lt;table&amp;gt;&lt;/code&gt; markup. AG Grid, MUI DataGrid, TanStack&lt;br&gt;
Table, Handsontable, Ant Design Table and most in-house React grids render&lt;br&gt;
nested div elements instead, and describe the structure to screen readers with&lt;br&gt;
ARIA roles:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;role=&lt;/span&gt;&lt;span class="s"&gt;"grid"&lt;/span&gt; &lt;span class="na"&gt;aria-rowcount=&lt;/span&gt;&lt;span class="s"&gt;"2431"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;role=&lt;/span&gt;&lt;span class="s"&gt;"row"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;role=&lt;/span&gt;&lt;span class="s"&gt;"columnheader"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Ticker&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;role=&lt;/span&gt;&lt;span class="s"&gt;"columnheader"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Last&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;role=&lt;/span&gt;&lt;span class="s"&gt;"row"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;role=&lt;/span&gt;&lt;span class="s"&gt;"gridcell"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;AAPL&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;role=&lt;/span&gt;&lt;span class="s"&gt;"gridcell"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;228.14&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;They do it because table layout is hard to virtualise, hard to pin columns in,&lt;br&gt;
and hard to resize smoothly. The trade is that anything looking for&lt;br&gt;
&lt;code&gt;document.querySelectorAll('table')&lt;/code&gt; comes back empty.&lt;/p&gt;
&lt;h2&gt;
  
  
  How to tell in five seconds
&lt;/h2&gt;

&lt;p&gt;Open DevTools, go to the Console, and run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelectorAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;table&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;
&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelectorAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;[role="grid"], [role="treegrid"], [role="table"]&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the first is 0 and the second is not, you have a div grid, and you now know&lt;br&gt;
why the extension found nothing.&lt;/p&gt;
&lt;h2&gt;
  
  
  What actually works
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Look for the grid's own export first.&lt;/strong&gt; Many admin panels have a Download CSV&lt;br&gt;
or Export button hiding in a toolbar or a row of icons. It is worth ten seconds&lt;br&gt;
of looking, because that route asks the server and gets every row, not just the&lt;br&gt;
ones on screen.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use an extractor that reads ARIA roles.&lt;/strong&gt; Anything that walks &lt;code&gt;role="row"&lt;/code&gt;&lt;br&gt;
and &lt;code&gt;role="gridcell"&lt;/code&gt; handles div grids. &lt;a href="https://gridpick-app.netlify.app/" rel="noopener noreferrer"&gt;GridPick&lt;/a&gt; was built around this&lt;br&gt;
case: it reads real table markup and ARIA grids, and it walks open shadow&lt;br&gt;
roots, which matters because &lt;code&gt;querySelectorAll&lt;/code&gt; does not cross a shadow&lt;br&gt;
boundary and several component libraries put their grid inside one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Or paste this into the console.&lt;/strong&gt; For a one-off, this copies the visible grid&lt;br&gt;
to your clipboard as tab-separated text, ready to paste straight into Excel:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;copy&lt;/span&gt;&lt;span class="p"&gt;([...&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelectorAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;[role="row"]&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[...&lt;/span&gt;&lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelectorAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;[role="gridcell"],[role="columnheader"]&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;c&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerText&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\s&lt;/span&gt;&lt;span class="sr"&gt;+/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt; &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;copy()&lt;/code&gt; is a DevTools helper, not a page function, so this only works from the&lt;br&gt;
console. If the grid is inside an iframe, switch the console context dropdown&lt;br&gt;
to that frame first.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two things that will still bite you
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Only the visible rows are in the page.&lt;/strong&gt; Virtualised grids create and destroy&lt;br&gt;
rows as you scroll, so the DOM holds fifty of them no matter how many the grid&lt;br&gt;
claims. Nothing running in the browser can see the rest. See&lt;br&gt;
&lt;a href="https://gridpick-app.netlify.app/table-export-missing-rows" rel="noopener noreferrer"&gt;why your table export only has the rows you can see&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Merged headers move your columns.&lt;/strong&gt; A header cell spanning two columns, or a&lt;br&gt;
section row written as &lt;code&gt;colspan="99"&lt;/code&gt;, quietly shifts everything under it. A&lt;br&gt;
naive extractor produces a 99-column export from that section row. The fix is&lt;br&gt;
to measure the real column count from the widest rows and clamp every span to&lt;br&gt;
it, which is what GridPick does before it hands you anything.&lt;/p&gt;

&lt;h2&gt;
  
  
  If the grid is server-driven
&lt;/h2&gt;

&lt;p&gt;When the page fetches its rows from an API, the cleanest route is not the DOM&lt;br&gt;
at all. Open the Network tab, filter to Fetch/XHR, sort the grid or turn a page&lt;br&gt;
so it refetches, and look at the JSON response. Most of the time you can call&lt;br&gt;
that endpoint yourself with a larger page size and get everything in one&lt;br&gt;
request. Copy the request as cURL from the context menu and it carries your&lt;br&gt;
session cookies with it.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>react</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
