Use the Excel Export API to Freeze Rows and Columns
You can lock a number of top rows and left columns to keep an area of the worksheet permanently visible while scrolling another worksheet area. To do this, create the XlCellPosition object to specify the position of a cell below the frozen rows and to the right of the frozen columns and assign it to the IXlSheet.SplitPosition property.
Important
If you create an XLSX document, specify the IXlSheet.SplitPosition property before you start generating columns, rows and cells.
To freeze the first row, use the following code:
// Freeze the first row in the worksheet.
sheet.SplitPosition = new XlCellPosition(0, 1);
To freeze the first column, use the following code:
// Freeze the first column in the worksheet.
sheet.SplitPosition = new XlCellPosition(1, 0);
To freeze the pane which contains one topmost row and one leftmost column, use the following code:
// Freeze the first column and the first row.
sheet.SplitPosition = new XlCellPosition(1, 1);