Query any HTML table with PRQL

2026-07-08

Once again I find myself searching through a giant table on Wikipedia. And again I think: it would be so much better if I could just query it with SQL or something. Wish someone made a browser extension for that!..

Aaand now I did. Here is the source code: https://codeberg.org/aka_dude/tableq. And here you can get it for your Firefox. Except this uses PRQL because it is much better that SQL. Here is an example:

Source (Wikipedia)
File system Block journaling Metadata-only journaling Case-sensitive Case-preserving File Change Log XIP
APFS ? ? Optional Yes ? ?
NTFS No Yes (2000) Yes Yes Yes ?
ext4 Yes Yes Yes, optional Yes No Yes

The button over upper-left corner activates the extension. Upon activation, column names are renamed to snake_case and a PRQL prompt appears. Try writing the following there and see what happens!

from t0
filter (file_change_log == 'Yes')

Note that the table still contains original HTML, e.g. the links are still there.

Some caveats:

All caveats should (and maybe will) be taken care of, but current functionality is enough for me.

Additional features (since 2026-08-08)

For web pages that include TableQ as script, there are some options.

  1. If table/thead includes <script type="tableq">, the contents of this script will be used instead of default from @table@. This can be used, for example, to make human-oriented textual data more convenient for querying. Here is the same table from above, but with Yes and No parsed as booleans:

    Source (Wikipedia)
    File system Block journaling Metadata-only journaling Case-sensitive Case-preserving File Change Log XIP
    APFS ? ? Optional Yes ? ?
    NTFS No Yes (2000) Yes Yes Yes ?
    ext4 Yes Yes Yes, optional Yes No Yes

    This allows for easier querying, like filter (file_change_log || xip).

  2. If th has attribute tableq-id, its value will be used for the column name. Can be used to provide terser names than the auto-generated ones.

  3. th and td may have non-zero colspan and rowspan. For td, the value will simply be copied into several sub-cells. For th, the column will be divided into sub-columns, and

    1. if tableq-id exists, spaces will be used as separators for names of sub-columns;
    2. otherwise, sub-columns will be named as ${column_generated_name}_${idx}.

For a real-world example of TableQ usage, check out this comparison of 3D printer filaments made by my friend: https://gospodin.codeberg.page/filaments.html.