Add a row to a table
Goal: Append a new row of data to an existing Markdown table.
Prerequisites: The table module, via -A or nodes.
Query
$ mq -A 'import "table" | table::tables | first | table::add_row(["Charlie", "35"])' README.md
Input
| Name | Age |
| ----- | --- |
| Alice | 30 |
Output
| Name | Age |
| ------- | --- |
| Alice | 30 |
| Charlie | 35 |
Notes
add_rowtakes a plain array of cell values, in column order — it will error if the array’s length doesn’t match the table’s column count.- Column widths are re-computed to fit the new data, which is why
Alicegets re-padded alongsideCharlie. - No
table::to_markdowncall needed here — mq expands table objects to Markdown automatically in query output. See Extract all tables from a document for whento_markdownactually is required.