There does not appear to be a way to export the customers and invoices nor a way to import them into another data file if you could export them.
However, as said in the comments to your question, your question seems predicated upon the notion that it is 'best practice' to create a new data file each year. This is not considered necessary
It should be noted that GnuCash reports should be able to provide
accurate year-end data for accounting purposes without zeroing
transactions, so book-closing may not be necessary. Leaving books
unclosed does mean that account balances in the Chart of Accounts will
not show Year-To-Date amounts.
- Closing Books GnuCash Wiki
The above linked wiki page has several methods to 'close the books' if that is what you want to do - but it is not necessary. There is even a description on how to create a new file for the new year which only talks about setting up the new accounts and transactions - nothing about customers, invoices etc. Note that you can 'close the books' without creating a new data file.
In summary: you cannot do it; but you don't need to create a new file for the new year so you don't need to do it.