mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-06 00:23:20 +00:00
Further polish to help
This commit is contained in:
@@ -11,32 +11,33 @@
|
||||
which will return the rule so that you can modify things which are specific to that type of rule,
|
||||
for example the values which correspond to each icon in an Icon set.
|
||||
.Example
|
||||
C:\> $excel = $avdata | Export-Excel -Path (Join-path $FilePath "\Machines.XLSX" ) -WorksheetName "Server Anti-Virus" -AutoSize -FreezeTopRow -AutoFilter -PassThru
|
||||
|
||||
C:\> Add-ConditionalFormatting -WorkSheet $excel.Workbook.Worksheets[1] -Address "b2:b1048576" -ForeGroundColor "RED" -RuleType ContainsText -ConditionValue "2003"
|
||||
C:\> Add-ConditionalFormatting -WorkSheet $excel.Workbook.Worksheets[1] -Address "i2:i1048576" -ForeGroundColor "RED" -RuleType ContainsText -ConditionValue "Disabled"
|
||||
C:\> $excel.Workbook.Worksheets[1].Cells["D1:G1048576"].Style.Numberformat.Format = [cultureinfo]::CurrentCulture.DateTimeFormat.ShortDatePattern
|
||||
C:\> $excel.Workbook.Worksheets[1].Row(1).style.font.bold = $true
|
||||
C:\> $excel.Save() ; $excel.Dispose()
|
||||
>
|
||||
PS> $excel = $avdata | Export-Excel -Path (Join-path $FilePath "\Machines.XLSX" ) -WorksheetName "Server Anti-Virus" -AutoSize -FreezeTopRow -AutoFilter -PassThru
|
||||
Add-ConditionalFormatting -WorkSheet $excel.Workbook.Worksheets[1] -Address "b2:b1048576" -ForeGroundColor "RED" -RuleType ContainsText -ConditionValue "2003"
|
||||
Add-ConditionalFormatting -WorkSheet $excel.Workbook.Worksheets[1] -Address "i2:i1048576" -ForeGroundColor "RED" -RuleType ContainsText -ConditionValue "Disabled"
|
||||
$excel.Workbook.Worksheets[1].Cells["D1:G1048576"].Style.Numberformat.Format = [cultureinfo]::CurrentCulture.DateTimeFormat.ShortDatePattern
|
||||
$excel.Workbook.Worksheets[1].Row(1).style.font.bold = $true
|
||||
$excel.Save() ; $excel.Dispose()
|
||||
|
||||
Here Export-Excel is called with the -passThru parameter so the Excel Package object is stored in $Excel
|
||||
The desired worksheet is selected and the then columns B and i are conditially formatted (excluding the top row) to show red text if
|
||||
the columns contain "2003" or "Disabled respectively. A fixed date format is then applied to columns D..G, and the top row is formatted.
|
||||
Finally the workbook is saved and the Excel object closed.
|
||||
.Example
|
||||
C:\> $r = Add-ConditionalFormatting -WorkSheet $excel.Workbook.Worksheets[1] -Range "B1:B100" -ThreeIconsSet Flags -Passthru
|
||||
C:\> $r.Reverse = $true ; $r.Icon1.Type = "Num"; $r.Icon2.Type = "Num" ; $r.Icon2.value = 100 ; $r.Icon3.type = "Num" ;$r.Icon3.value = 1000
|
||||
>
|
||||
>PS $r = Add-ConditionalFormatting -WorkSheet $excel.Workbook.Worksheets[1] -Range "B1:B100" -ThreeIconsSet Flags -Passthru
|
||||
$r.Reverse = $true ; $r.Icon1.Type = "Num"; $r.Icon2.Type = "Num" ; $r.Icon2.value = 100 ; $r.Icon3.type = "Num" ;$r.Icon3.value = 1000
|
||||
|
||||
Again Export-Excel has been called with -passthru leaving a package object in $Excel
|
||||
This time B1:B100 has been conditionally formatted with 3 icons, using the flags icon set.
|
||||
Add-ConditionalFormatting does not provide access to every option in the formatting rule, so passthru has been used and the
|
||||
rule is to apply the flags in reverse order, and boundaries for the number which will set the split are set to 100 and 1000
|
||||
.Example
|
||||
C:\> Add-ConditionalFormatting -WorkSheet $sheet -Range "D2:D1048576" -DataBarColor Red
|
||||
Add-ConditionalFormatting -WorkSheet $sheet -Range "D2:D1048576" -DataBarColor Red
|
||||
|
||||
This time $sheet holds an ExcelWorkseet object and databars are add to all of column D except for the tip row.
|
||||
.Example
|
||||
C:\> Add-ConditionalFormatting -Address $worksheet.cells["FinishPosition"] -RuleType Equal -ConditionValue 1 -ForeGroundColor Purple -Bold -Priority 1 -StopIfTrue
|
||||
Add-ConditionalFormatting -Address $worksheet.cells["FinishPosition"] -RuleType Equal -ConditionValue 1 -ForeGroundColor Purple -Bold -Priority 1 -StopIfTrue
|
||||
|
||||
In this example a named range is used to select the cells where the formula should apply. If a cell in the "FinishPosition" range is 1, then the text is turned to puple, boldface.
|
||||
This rule is move to first in the priority list, and where cells have a value of 1, no other rules will be processed.
|
||||
|
||||
@@ -178,7 +178,8 @@
|
||||
Export all the processes to the Excel file 'Test.xlsx' and open the file immediately.
|
||||
|
||||
.EXAMPLE
|
||||
$ExcelParams = @{
|
||||
>
|
||||
PS> $ExcelParams = @{
|
||||
Path = $env:TEMP + '\Excel.xlsx'
|
||||
Show = $true
|
||||
Verbose = $true
|
||||
@@ -190,7 +191,8 @@
|
||||
Exports all data to the Excel file 'Excel.xslx' and colors the negative values in 'Red' and the positive values in 'Blue'. It will also add a dollar sign '$' in front of the rounded numbers to two decimal characters behind the comma.
|
||||
|
||||
.EXAMPLE
|
||||
$ExcelParams = @{
|
||||
>
|
||||
PS> $ExcelParams = @{
|
||||
Path = $env:TEMP + '\Excel.xlsx'
|
||||
Show = $true
|
||||
Verbose = $true
|
||||
@@ -215,7 +217,8 @@
|
||||
Exports all data to the Excel file 'Excel.xslx' and tries to convert all values to numbers where possible except for 'IPAddress' and 'Number1'. These are stored in the sheet 'as is', without being converted to a number.
|
||||
|
||||
.EXAMPLE
|
||||
$ExcelParams = @{
|
||||
>
|
||||
PS> $ExcelParams = @{
|
||||
Path = $env:TEMP + '\Excel.xlsx'
|
||||
Show = $true
|
||||
Verbose = $true
|
||||
@@ -240,7 +243,8 @@
|
||||
Exports all data to the Excel file 'Excel.xslx' as is, no number conversion will take place. This means that Excel will show the exact same data that you handed over to the 'Export-Excel' function.
|
||||
|
||||
.EXAMPLE
|
||||
$ExcelParams = @{
|
||||
>
|
||||
PS> $ExcelParams = @{
|
||||
Path = $env:TEMP + '\Excel.xlsx'
|
||||
Show = $true
|
||||
Verbose = $true
|
||||
@@ -254,7 +258,8 @@
|
||||
Exports data that will have a 'Conditional formatting rule' in Excel on these cells that will show the background fill color in 'LightPink' and the text color in 'DarkRed' when the value is greater then '525'. In case this condition is not met the color will be the default, black text on a white background.
|
||||
|
||||
.EXAMPLE
|
||||
$ExcelParams = @{
|
||||
>
|
||||
PS> $ExcelParams = @{
|
||||
Path = $env:TEMP + '\Excel.xlsx'
|
||||
Show = $true
|
||||
Verbose = $true
|
||||
@@ -269,7 +274,8 @@
|
||||
Export all services to an Excel sheet where all cells have a 'Conditional formatting rule' in Excel that will show the background fill color in 'LightPink' and the text color in 'DarkRed' when the value contains the word 'Stop'. If the value contains the word 'Running' it will have a background fill color in 'Cyan' and a text color 'Blue'. In case none of these conditions are met the color will be the default, black text on a white background.
|
||||
|
||||
.EXAMPLE
|
||||
$ExcelParams = @{
|
||||
>
|
||||
PS> $ExcelParams = @{
|
||||
Path = $env:TEMP + '\Excel.xlsx'
|
||||
Show = $true
|
||||
Verbose = $true
|
||||
@@ -312,7 +318,8 @@
|
||||
Get-Service | Export-Excel 'c:\temp\test.xlsx' -Show -IncludePivotTable -PivotRows status -PivotData @{status='count'}
|
||||
|
||||
.EXAMPLE
|
||||
$pt = [ordered]@{}
|
||||
>
|
||||
PS> $pt = [ordered]@{}
|
||||
$pt.pt1=@{ SourceWorkSheet = 'Sheet1';
|
||||
PivotRows = 'Status'
|
||||
PivotData = @{'Status'='count'}
|
||||
@@ -335,7 +342,8 @@
|
||||
|
||||
|
||||
.EXAMPLE
|
||||
Remove-Item -Path .\test.xlsx
|
||||
>
|
||||
PS> Remove-Item -Path .\test.xlsx
|
||||
$excel = Get-Service | Select-Object -Property Status,Name,DisplayName,StartType | Export-Excel -Path .\test.xlsx -PassThru
|
||||
$excel.Workbook.Worksheets["Sheet1"].Row(1).style.font.bold = $true
|
||||
$excel.Workbook.Worksheets["Sheet1"].Column(3 ).width = 29
|
||||
@@ -348,7 +356,8 @@
|
||||
It then uses the package object to apply formatting, and then saves the workbook and disposes of the object before loading the document in Excel.
|
||||
|
||||
.EXAMPLE
|
||||
Remove-Item -Path .\test.xlsx -ErrorAction Ignore
|
||||
>
|
||||
PS> Remove-Item -Path .\test.xlsx -ErrorAction Ignore
|
||||
|
||||
$excel = Get-Process | Select-Object -Property Name,Company,Handles,CPU,PM,NPM,WS | Export-Excel -Path .\test.xlsx -ClearSheet -WorksheetName "Processes" -PassThru
|
||||
$sheet = $excel.Workbook.Worksheets["Processes"]
|
||||
|
||||
@@ -8,7 +8,10 @@
|
||||
In the former case the header row is copied from the first sheet and, by default, each row of data is labelled with the name of the sheet it came from.
|
||||
In the latter case -NoHeader is specified, and each copied block can have the sheet it came from placed above it as a title.
|
||||
.EXAMPLE
|
||||
foreach ($computerName in @('Server1', 'Server2', 'Server3', 'Server4')) {
|
||||
|
||||
.EXAMPLE
|
||||
>
|
||||
PS> foreach ($computerName in @('Server1', 'Server2', 'Server3', 'Server4')) {
|
||||
Get-Service -ComputerName $computerName | Select-Object -Property Status, Name, DisplayName, StartType |
|
||||
Export-Excel -Path .\test.xlsx -WorkSheetname $computerName -AutoSize
|
||||
}
|
||||
@@ -22,13 +25,14 @@
|
||||
Join-Worksheet finishes by calling export-Excel to AutoSize cells, freeze the top row and make it bold and add the Pivot table.
|
||||
|
||||
.EXAMPLE
|
||||
Get-WmiObject -Class win32_logicaldisk | select -Property DeviceId,VolumeName, Size,Freespace |
|
||||
>
|
||||
PS> Get-WmiObject -Class win32_logicaldisk | select -Property DeviceId,VolumeName, Size,Freespace |
|
||||
Export-Excel -Path "$env:computerName.xlsx" -WorkSheetname Volumes -NumberFormat "0,000"
|
||||
Get-NetAdapter | Select-Object Name,InterfaceDescription,MacAddress,LinkSpeed |
|
||||
Export-Excel -Path "$env:COMPUTERNAME.xlsx" -WorkSheetname NetAdapter
|
||||
Join-Worksheet -Path "$env:COMPUTERNAME.xlsx" -WorkSheetName Summary -Title "Summary" -TitleBold -TitleSize 22 -NoHeader -LabelBlocks -AutoSize -HideSource -show
|
||||
|
||||
The first two command get logical disk and network card information; each type is exported to its own sheet in a workbook.
|
||||
The first two commands get logical disk and network card information; each type is exported to its own sheet in a workbook.
|
||||
The Join-worksheet command copies both onto a page named "Summary". Because the data is disimilar -NoHeader is specified, ensuring the whole of each page is copied.
|
||||
Specifying -LabelBlocks causes each sheet's name to become a title on the summary page above the copied data.
|
||||
The source data is hidden, a title is added in 22 point boldface and the columns are sized to fit the data.
|
||||
|
||||
@@ -82,7 +82,8 @@ function New-ExcelChartDefinition {
|
||||
.PARAMETER Header
|
||||
No longer used. This may be removed in future versions
|
||||
.Example
|
||||
$cDef = New-ExcelChartDefinition -ChartType line -XRange "X" -YRange "Sinx" -Title "Graph of Sine X" -TitleBold -TitleSize 14 `
|
||||
>
|
||||
PS> $cDef = New-ExcelChartDefinition -ChartType line -XRange "X" -YRange "Sinx" -Title "Graph of Sine X" -TitleBold -TitleSize 14 `
|
||||
-Column 2 -ColumnOffSetPixels 35 -Width 800 -XAxisTitleText "Degrees" -XAxisTitleBold -XAxisTitleSize 12 -XMajorUnit 30 -XMinorUnit 10 -XMinValue 0 -XMaxValue 361 -XAxisNumberformat "000" `
|
||||
-YMinValue -1.25 -YMaxValue 1.25 -YMajorUnit 0.25 -YAxisNumberformat "0.00" -YAxisTitleText "Sine" -YAxisTitleBold -YAxisTitleSize 12 `
|
||||
-SeriesHeader "Sin(x)" -LegendSize 8 -legendBold -LegendPostion Bottom
|
||||
@@ -265,7 +266,8 @@ function Add-ExcelChart {
|
||||
.PARAMETER PassThru
|
||||
Add-Excel chart doesn't normally return anything, but if -PassThru is specified it returns the newly created chart to allow it to be fine tuned
|
||||
.EXAMPLE
|
||||
$Excel = ConvertFrom-Csv @"
|
||||
>
|
||||
PS> $Excel = ConvertFrom-Csv @"
|
||||
Product, City, Sales
|
||||
Apple, London , 300
|
||||
Orange, London , 400
|
||||
@@ -282,7 +284,8 @@ function Add-ExcelChart {
|
||||
combine the name of the product and the name of the City to create the table.
|
||||
The width of the chart is set explictly, the default legend is used and there is no Chart title.
|
||||
.EXAMPLE
|
||||
$Excel = Invoke-Sum (Get-Process) Company Handles, PM, VirtualMemorySize | Export-Excel $path -AutoSize -ExcelChartDefinition $c -AutoNameRange -PassThru
|
||||
>
|
||||
PS> $Excel = Invoke-Sum (Get-Process) Company Handles, PM, VirtualMemorySize | Export-Excel $path -AutoSize -ExcelChartDefinition $c -AutoNameRange -PassThru
|
||||
Add-ExcelChart -Worksheet $Excel.Workbook.Worksheets[1] -Title "VM use" -ChartType PieExploded3D -XRange "Name" -YRange "VirtualMemorySize" -NoLegend -ShowCategory
|
||||
Close-ExcelPackage $Excel -Show
|
||||
|
||||
@@ -290,7 +293,8 @@ function Add-ExcelChart {
|
||||
The Second line uses the ranges to specify a chart - the labels come from the range "Name" and the data from the range "VirtualMemorySize"
|
||||
The chart is specified as a 3D exploded PIE chart, with a title of "VM Use" and instead of a legend the the pie slices are identified with a label.
|
||||
.EXAMPLE
|
||||
$Excel = Invoke-Sum (Get-Process) Company Handles, PM, VirtualMemorySize | Export-Excel test.xlsx -TableName Processes -PassThru
|
||||
>
|
||||
PS> $Excel = Invoke-Sum (Get-Process) Company Handles, PM, VirtualMemorySize | Export-Excel test.xlsx -TableName Processes -PassThru
|
||||
Add-ExcelChart -Worksheet $Excel.Workbook.Worksheets[1] -Title Stats -ChartType LineMarkersStacked -XRange "Processes[Name]" -YRange "Processes[PM]", "Processes[VirtualMemorySize]" -SeriesHeader 'PM', 'VMSize'
|
||||
Close-ExcelPackage $Excel -Show
|
||||
|
||||
@@ -298,7 +302,8 @@ function Add-ExcelChart {
|
||||
The second line creates a chart on the first page of the work sheet, using the notation "TableName[ColumnnName]" to refer to the data,
|
||||
the labels come Name column in the table, and the data series from its PM and VirtualMemorySize columns. The display names for these in the header are set to PM and VMSize
|
||||
.EXAMPLE
|
||||
$excel = 0..360 | ForEach-Object {[pscustomobject][ordered]@{x = $_; Sinx = "=Sin(Radians(x)) "}} | Export-Excel -AutoNameRange -Path Text.xlsx -WorkSheetname SinX -PassThru
|
||||
>
|
||||
PS> $excel = 0..360 | ForEach-Object {[pscustomobject][ordered]@{x = $_; Sinx = "=Sin(Radians(x)) "}} | Export-Excel -AutoNameRange -Path Text.xlsx -WorkSheetname SinX -PassThru
|
||||
Add-ExcelChart -Worksheet $excel.Workbook.Worksheets["Sinx"] -ChartType line -XRange "X" -YRange "Sinx" -Title "Graph of Sine X" -TitleBold -TitleSize 14 `
|
||||
-Column 2 -ColumnOffSetPixels 35 -Width 800 -XAxisTitleText "Degrees" -XAxisTitleBold -XAxisTitleSize 12 -XMajorUnit 30 -XMinorUnit 10 -XMinValue 0 -XMaxValue 361 -XAxisNumberformat "000" `
|
||||
-YMinValue -1.25 -YMaxValue 1.25 -YMajorUnit 0.25 -YAxisNumberformat "0.00" -YAxisTitleText "Sine" -YAxisTitleBold -YAxisTitleSize 12 `
|
||||
|
||||
@@ -8,13 +8,15 @@
|
||||
It takes a KillExcel switch to make sure Excel is not holding the file open; a password parameter for existing protected files,
|
||||
and a create switch to set-up a new file if no file already exists.
|
||||
.Example
|
||||
$excel = Open-ExcelPackage -Path "$env:TEMP\test99.xlsx" -Create
|
||||
>
|
||||
PS> $excel = Open-ExcelPackage -Path "$env:TEMP\test99.xlsx" -Create
|
||||
$ws = Add-WorkSheet -ExcelPackage $excel
|
||||
|
||||
This will create a new file in the temp folder if it doesn't already exist. It then adds a worksheet -
|
||||
because no name is specified it will use the default name of "Sheet1"
|
||||
.Example
|
||||
$excel = Open-ExcelPackage -path "$xlPath" -Password $password
|
||||
>
|
||||
PS> $excel = Open-ExcelPackage -path "$xlPath" -Password $password
|
||||
$sheet1 = $excel.Workbook.Worksheets["sheet1"]
|
||||
Set-ExcelRange -Range $sheet1.Cells["E1:S1048576"], $sheet1.Cells["V1:V1048576"] -NFormat ([cultureinfo]::CurrentCulture.DateTimeFormat.ShortDatePattern)
|
||||
Close-ExcelPackage $excel -Show
|
||||
|
||||
@@ -5,14 +5,16 @@
|
||||
.Description
|
||||
If the pivot table already exists, the source data will be updated.
|
||||
.Example
|
||||
$excel = Get-Service | Export-Excel -Path test.xlsx -WorksheetName Services -PassThru -AutoSize -DisplayPropertySet -TableName ServiceTable -Title "Services on $Env:COMPUTERNAME"
|
||||
>
|
||||
PS> $excel = Get-Service | Export-Excel -Path test.xlsx -WorksheetName Services -PassThru -AutoSize -DisplayPropertySet -TableName ServiceTable -Title "Services on $Env:COMPUTERNAME"
|
||||
Add-PivotTable -ExcelPackage $excel -PivotTableName ServiceSummary -SourceRange $excel.Workbook.Worksheets[1].Tables[0].Address -PivotRows Status -PivotData Name -NoTotalsInPivot -Activate
|
||||
Close-ExcelPackage $excel -Show
|
||||
|
||||
This exports data to new workbook and creates a table with the data in.
|
||||
The Pivot table is added on its own page, the table created in the first command is used as the source for the PivotTable; which counts the service names in for each Status. At the end the Pivot page is made active.
|
||||
.Example
|
||||
$chartdef = New-ExcelChartDefinition -Title "Gross and net by city and product" -ChartType ColumnClustered `
|
||||
>
|
||||
PS> $chartdef = New-ExcelChartDefinition -Title "Gross and net by city and product" -ChartType ColumnClustered `
|
||||
-Column 11 -Width 500 -Height 360 -YMajorUnit 500 -YMinorUnit 100 -YAxisNumberformat "$#,##0" -LegendPostion Bottom
|
||||
|
||||
$excel = ConvertFrom-Csv @"
|
||||
@@ -30,6 +32,7 @@
|
||||
-PivotNumberFormat "$#,##0.00" -PivotTotals Both -PivotTableSyle Medium12 -PivotChartDefinition $chartdef
|
||||
Close-ExcelPackage -show $excel
|
||||
|
||||
|
||||
This script starts by defining a chart. Then it exports some data to an XLSX file and keeps the file open.
|
||||
The next step is to add the pivot table, normally this would be on its own sheeet in the workbook,
|
||||
but here -Address is specified to place it beside the data. The Add-Pivot table is given the chart definition and told to create a tale
|
||||
@@ -234,7 +237,8 @@ function New-PivotTableDefinition {
|
||||
Its -PivotTableDefintion paramater allows multiple pivot tables to be defined, with additional parameters.
|
||||
New-PivotTableDefinition is a convenient way to build these definitions.
|
||||
.Example
|
||||
$pt = New-PivotTableDefinition -PivotTableName "PT1" -SourceWorkSheet "Sheet1" -PivotRows "Status" -PivotData @{Status='Count' } -PivotFilter 'StartType' -IncludePivotChart -ChartType BarClustered3D
|
||||
>
|
||||
PS> $pt = New-PivotTableDefinition -PivotTableName "PT1" -SourceWorkSheet "Sheet1" -PivotRows "Status" -PivotData @{Status='Count' } -PivotFilter 'StartType' -IncludePivotChart -ChartType BarClustered3D
|
||||
$Pt += New-PivotTableDefinition -PivotTableName "PT2" -SourceWorkSheet "Sheet2" -PivotRows "Company" -PivotData @{Company='Count'} -IncludePivotChart -ChartType PieExploded3D -ShowPercent -ChartTitle "Breakdown of processes by company"
|
||||
Get-Service | Select-Object -Property Status,Name,DisplayName,StartType | Export-Excel -Path .\test.xlsx -AutoSize
|
||||
Get-Process | Select-Object -Property Name,Company,Handles,CPU,VM | Export-Excel -Path .\test.xlsx -AutoSize -WorksheetName 'sheet2'
|
||||
|
||||
@@ -8,19 +8,19 @@
|
||||
A column heading can be specified and the new column can be made a named range.
|
||||
The column can be formatted in the same operation.
|
||||
.EXAMPLE
|
||||
C:\> Set-ExcelColumn -Worksheet $ws -Column 5 -NumberFormat 'Currency'
|
||||
Set-ExcelColumn -Worksheet $ws -Column 5 -NumberFormat 'Currency'
|
||||
|
||||
$ws contains a worksheet object - and column E is set to use the local currecy format.
|
||||
Intelisense will complete predefined number formats. You can see how currency is interpreted on the local computer with the command
|
||||
Expand-NumberFormat currency
|
||||
.EXAMPLE
|
||||
C:\> Set-ExcelColumn -Worksheet $ws -Heading "WinsToFastLaps" -Value {"=E$row/C$row"} -Column 7 -AutoSize -AutoNameRange
|
||||
Set-ExcelColumn -Worksheet $ws -Heading "WinsToFastLaps" -Value {"=E$row/C$row"} -Column 7 -AutoSize -AutoNameRange
|
||||
|
||||
Here $WS already contains a worksheet which contains counts of races won and fastest laps recorded by racing drivers (in columns C and E)
|
||||
Set-ExcelColumn specifies that Column 7 should have a heading of "WinsToFastLaps" and the data cells should contain =E2/C2 , =E3/C3 etc
|
||||
the data cells should become a named range, which will also be "WinsToFastLaps" the column width will be set automatically
|
||||
.EXAMPLE
|
||||
C:\> Set-ExcelColumn -Worksheet $ws -Heading "Link" -Value {"https://en.wikipedia.org" + $worksheet.cells["B$Row"].value } -AutoSize
|
||||
Set-ExcelColumn -Worksheet $ws -Heading "Link" -Value {"https://en.wikipedia.org" + $worksheet.cells["B$Row"].value } -AutoSize
|
||||
|
||||
In this example, the worksheet in $ws has partial links to wikipedia pages in column B.
|
||||
The Value parameter is is a script block and it outputs a string which begins https... and ends with the value of cell at column B in the current row.
|
||||
|
||||
Reference in New Issue
Block a user