The only thing that worked for me was this VBA:
ActiveSheet.PageSetup.PrintTitleRows = ActiveSheet.Rows(1).Address
from https://learn.microsoft.com/en-us/office/vba/api/excel.pagesetup.printtitlerows