To utilize Powershell's export-excel Add-ConditionalFormatting function with RuleType ThreeColorScale, follow the steps below:
Open Powershell and import the module "Import-Module ImportExcel".
Create an object of the Excel Worksheet using the "New-ExcelWorksheet" cmdlet.
Populate the worksheet with data by creating an array or importing data from a file.
Use the "Add-ConditionalFormatting" function to apply conditional formatting to the worksheet.
Set the "Type" parameter of the function to "ThreeColorScale".
Set the "Minimum", "Middle", and "Maximum" parameters of the function to configure the color scale.
Set the "Range" parameter of the function to specify the range of cells to apply the formatting to.
Save the worksheet as an Excel file using the "Export-Excel" cmdlet.
Example:
$data = @(1,2,3,4,5,6,7,8,9) $worksheet = New-ExcelWorksheet -Name "Data" $worksheet.Cells["A1"].LoadFromCollection($data,$true) Add-ConditionalFormatting -Range ($worksheet.Cells["A1:A9"]) -Type ThreeColorScale -Minimum 1 -Middle 5 -Maximum 9 Export-Excel -Path "C:\Users\Example\Documents\Data.xlsx" -Worksheet $worksheet
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-05-18 16:17:04 +0000
Seen: 8 times
Last updated: May 18 '23
How can data extraction from BigQuery and loading it into SQL Server be done in an optimal manner?
How can one ensure that sub-classes have uniform method parameters in TypeScript?
How can the calculation of matrix determinant be performed using CUDA?
How can code repetition be prevented when using (box)plot functions?
When I attempt to generate a database, why does the azure-cosmos-emulator become unresponsive?
What steps can I take to prevent my webpage from slowing down when all parts of a div are displayed?