ImportExcel icon indicating copy to clipboard operation
ImportExcel copied to clipboard

Is there a way to freeze top rows and/or column after a bunch of Set-ExcelRange calls?

Open kwein123 opened this issue 1 year ago • 1 comments

Pardon me if my code style is backwards from Doug's examples. In my work, I create a custom spreadsheet from various data. After all that formatting, I would like to freeze the top two rows and first column. But if I try something like this, it errors out:

Set-ExcelRange -Worksheet $Worksheet -Address $Range -FreezeTopRow

If I try something like this at the end of my script, it doesn't error, but doesn't do anything helpful, either:

Export-Excel -ExcelPackage $Excel -FreezeTopRow

kwein123 avatar Jun 27 '24 01:06 kwein123

@kwein123 thanks for using ImportExcel.

Not backwards at all. That would be a good guess and I didn't implement it that way, (unfortunately?)

You need to grab the the worksheet and then: $ws.View.FreezePanes(3, 2)

dfinke avatar Jun 28 '24 00:06 dfinke

That worked great! Thanks for all your help.

kwein123 avatar Jul 18 '24 14:07 kwein123