@ChrisW67, your advice solved my problem.

I added:
Qt Code:
  1. table_view.setHorizontalHeaderLabels([str(x) for x in range(1, columns + 1)])
  2. table_view.setVerticalHeaderLabels([str(x) for x in range(1, rows + 1)])
To copy to clipboard, switch view to plain text mode