We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://github.com/dfinke/ImportExcel/blob/61744012cdb84a8bc79be2bab8f8db2a6df37af1/Public/Export-Excel.ps1#L666C63-L666C63
Using the example i was able to get it to work with a minor tweak to the regex.
I would add a pull request but i'm not sure of the history here... im guessing dimensions.address had a former format?
dimensions.address
$xlSourcefile = "$env:TEMP\ImportExcelExample.xlsx" Write-Verbose -Verbose -Message "Save location: $xlSourcefile" Remove-Item $xlSourcefile -ErrorAction Ignore Get-Process | Select-Object -First 20 -Property Company,Handles,PM, NPM| Export-Excel $xlSourcefile -Show -AutoSize -CellStyleSB { param( $workSheet, $totalRows, $lastColumn ) $lastColumn = $workSheet.Dimension.Address -replace "^.*:([A-Z|a-z]*)\d+$", '$1' # <-- modified $lastColumn Set-CellStyle $workSheet 1 $LastColumn Solid Cyan foreach($row in (2..$totalRows | Where-Object {$_ % 2 -eq 0})) { Set-CellStyle $workSheet $row $LastColumn Solid Gray } foreach($row in (2..$totalRows | Where-Object {$_ % 2 -eq 1})) { Set-CellStyle $workSheet $row $LastColumn Solid LightGray } }
Example of regex update:
> $worksheet.Dimension.Address A1:P21 > $worksheet.Dimension.Address -replace "^.*:(\w*)\d+$" , '$1' P2 > $worksheet.Dimension.Address -replace "^.*:([A-Z|a-z]*)\d+$" , '$1' P # verified double letter columns works: > 'AA1:BB300' -replace "^.*:([A-Z|a-z]*)\d+$" , '$1' BB
The text was updated successfully, but these errors were encountered:
I just remembered, this could work as well:
$(Get-ExcelColumnName -ColumnNumber $worksheet.Dimension.Columns).ColumnName
Sorry, something went wrong.
Thanks for checking that out. CellStyleSB was an experimental concept. Happy to look at a PR and discuss.
CellStyleSB
No branches or pull requests
https://github.com/dfinke/ImportExcel/blob/61744012cdb84a8bc79be2bab8f8db2a6df37af1/Public/Export-Excel.ps1#L666C63-L666C63
Using the example i was able to get it to work with a minor tweak to the regex.
I would add a pull request but i'm not sure of the history here... im guessing
dimensions.address
had a former format?Example of regex update:
The text was updated successfully, but these errors were encountered: