Brainstorming, With script, How to transform spread rows into HEADER_ROWS or to BODY_ROWS?

God of all gods, come up with an good idea together.
Hi m1b.
I am sorry, I still couldn't help myself. Confusion is torture.
When there is only one row in the header, it can be directly converted to a header.
like this:
var doc = app.activeDocument,
selectedRows = getRows(doc.selection[0]);
var headerRows = convertToRowType(selectedRows, RowTypes.HEADER_ROW);
But when there are cross row columns, conversion is not allowed.
Sometimes it needs to be converted to BODY_ROWS, and sometimes it needs to be converted to HEADER_ROWS.
