Hi and welcome to the forum!
This should achieve what you’re looking for:
#show table: it => {
let fields = it.fields()
let children = fields.remove("children")
if children.at(0, default: none).func() == table.header {
// already has a header
return it
}
let cols = it.columns.len()
let firstrow = children.slice(0, cols)
let rest = children.slice(cols)
table(
..fields,
table.header(..firstrow),
..rest
)
}
(Inspiration taken from here)