# Add-OfficeExcelImage

Adds an image anchored to a worksheet cell or range.

Project

PSWriteOffice

PowerShell document automation across OfficeIMO's document, spreadsheet, presentation, PDF, Project, Access, EPUB, invoicing, and conversion engines.

[View on GitHub](https://github.com/EvotecIT/OfficeIMO/tree/master/PowerShell/PSWriteOffice) [Visit Website](#) [Releases](https://github.com/EvotecIT/PSWriteOffice/releases/tag/v3.0.5) [Changelog](#) [Get package](https://www.powershellgallery.com/packages/PSWriteOffice/0.2.0)

Stars **725**

Forks **84**

Open issues **4**

Total downloads **5,250,223**

Release **OfficeIMO-v3.6.2**

Language: C# Updated: 2026-11-24

Cmdlet 

Aliases: ExcelImage

**Module**

`PSWriteOffice`

**Aliases**

`ExcelImage`

**Inputs**

`OfficeIMO.Excel.ExcelDocument`

**Source**

[AddOfficeExcelImageCommand.cs:31](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Excel/AddOfficeExcelImageCommand.cs#L31) 

Adds an image anchored to a worksheet cell or range.

## Syntax

```
Add-OfficeExcelImage
[-Address <String>]
[-AltText <String>]
[-Column <Int32>]
[-Decorative]
[-EndOffsetXPixels <Int32>]
[-EndOffsetYPixels <Int32>]
[-HeightPixels <Int32>]
[-LockAspectRatio]
[-Name <String>]
[-NoLockAspectRatio]
[-OffsetXPixels <Int32>]
[-OffsetYPixels <Int32>]
[-PassThru]
[-Path] <String>
[-Placement <MoveAndSize|MoveOnly|FreeFloating>]
[-Range <String>]
[-RotationDegrees <Double>]
[-Row <Int32>]
[-ScalePercent <Double>]
[-Title <String>]
[-WidthPixels <Int32>]
[<CommonParameters>]
```

[#](#member-f9d15ae933cd3ef619c6a4a7)

Parameter set: `ContextPath`

```
Add-OfficeExcelImage
[-Address <String>]
[-AltText <String>]
[-Column <Int32>]
[-Decorative]
-Document <ExcelDocument>
[-EndOffsetXPixels <Int32>]
[-EndOffsetYPixels <Int32>]
[-HeightPixels <Int32>]
[-LockAspectRatio]
[-Name <String>]
[-NoLockAspectRatio]
[-OffsetXPixels <Int32>]
[-OffsetYPixels <Int32>]
[-PassThru]
[-Path] <String>
[-Placement <MoveAndSize|MoveOnly|FreeFloating>]
[-Range <String>]
[-RotationDegrees <Double>]
[-Row <Int32>]
[-ScalePercent <Double>]
[-Sheet <String>]
[-SheetIndex <Int32>]
[-Title <String>]
[-WidthPixels <Int32>]
[<CommonParameters>]
```

[#](#member-967e9144b1f2db52ddfdb186)

Parameter set: `DocumentPath`

```
Add-OfficeExcelImage
[-Address <String>]
[-AltText <String>]
[-Column <Int32>]
[-Decorative]
-Document <ExcelDocument>
[-EndOffsetXPixels <Int32>]
[-EndOffsetYPixels <Int32>]
[-HeightPixels <Int32>]
[-LockAspectRatio]
[-Name <String>]
[-NoLockAspectRatio]
[-OffsetXPixels <Int32>]
[-OffsetYPixels <Int32>]
[-PassThru]
[-Placement <MoveAndSize|MoveOnly|FreeFloating>]
[-Range <String>]
[-RotationDegrees <Double>]
[-Row <Int32>]
[-ScalePercent <Double>]
[-Sheet <String>]
[-SheetIndex <Int32>]
[-Title <String>]
[-Url] <String>
[-WidthPixels <Int32>]
[<CommonParameters>]
```

[#](#member-b1dccfb153c14bef28833678)

Parameter set: `DocumentUrl`

```
Add-OfficeExcelImage
[-Address <String>]
[-AltText <String>]
[-Column <Int32>]
[-Decorative]
[-EndOffsetXPixels <Int32>]
[-EndOffsetYPixels <Int32>]
[-HeightPixels <Int32>]
[-LockAspectRatio]
[-Name <String>]
[-NoLockAspectRatio]
[-OffsetXPixels <Int32>]
[-OffsetYPixels <Int32>]
[-PassThru]
[-Placement <MoveAndSize|MoveOnly|FreeFloating>]
[-Range <String>]
[-RotationDegrees <Double>]
[-Row <Int32>]
[-ScalePercent <Double>]
[-Title <String>]
[-Url] <String>
[-WidthPixels <Int32>]
[<CommonParameters>]
```

[#](#member-44ada00e4189bc4e9a2c27ff)

Parameter set: `ContextUrl`

## Examples

### Insert a scaled image from disk at B2.

```powershell
ExcelSheet 'Data' { Add-OfficeExcelImage -Address 'B2' -Path .\logo.png -ScalePercent 20 -Name Logo -AltText 'Company logo' }
```

Anchors the image to cell B2 and sizes it to 20 percent of the original image dimensions.

### Pin an image to a worksheet range.

```powershell
ExcelSheet 'Data' { Add-OfficeExcelImage -Range 'A1:C15' -Path .\logo.png -Name HeaderLogo -Placement MoveAndSize }
```

Uses Excel's two-cell anchor so the picture moves and resizes with the cells in A1:C15.

### Insert and rotate an image from a URL.

```powershell
ExcelSheet 'Data' { Add-OfficeExcelImage -Row 1 -Column 1 -Url 'https://example.org/logo.png' -WidthPixels 96 -HeightPixels 32 -RotationDegrees 12 }
```

Downloads, sizes, rotates, and anchors the image to cell A1.

## Parameters

**-Address String optionalaliases: Cell**

A1-style cell address (e.g., A1, C5).

**-AltText String optional**

Optional alternative text description for accessibility.

**-Column Int32 optional**

1-based column index.

**-Decorative SwitchParameter optional**

Marks the image as decorative by clearing alternative text metadata.

**-EndOffsetXPixels Int32 optional**

Horizontal offset in pixels for the range end marker when using Range.

**-EndOffsetYPixels Int32 optional**

Vertical offset in pixels for the range end marker when using Range.

**-HeightPixels Int32 optionalaliases: Height**

Image height in pixels.

**-LockAspectRatio SwitchParameter optional**

Lock the image aspect ratio in Excel. This is the default unless NoLockAspectRatio is used.

**-Name String optional**

Optional drawing name used by Excel's selection pane.

**-NoLockAspectRatio SwitchParameter optional**

Do not lock the image aspect ratio in Excel.

**-OffsetXPixels Int32 optional**

Horizontal offset in pixels from the cell origin.

**-OffsetYPixels Int32 optional**

Vertical offset in pixels from the cell origin.

**-PassThru SwitchParameter optional**

Emit the worksheet after inserting the image.

**-Path String requiredposition: 0sets: ContextPath, DocumentPath**

Image file path.

**-Placement ExcelImagePlacement optional**

How a range-anchored image behaves when cells move or resize.

Possible values: `MoveAndSize`, `MoveOnly`, `FreeFloating`

**-Range String optional**

A1-style range (for example, A1:C15) for a two-cell anchor that can move and resize with cells.

**-RotationDegrees Double optional**

Clockwise image rotation in degrees.

**-Row Int32 optional**

1-based row index.

**-ScalePercent Double optional**

Percentage of the original image size. Cannot be combined with WidthPixels or HeightPixels.

**-Title String optional**

Optional alternative text title.

**-WidthPixels Int32 optionalaliases: Width**

Image width in pixels.

**-Document ExcelDocument requiredpipeline: True (ByValue)sets: DocumentPath, DocumentUrl**

Workbook to operate on outside the DSL context.

**-Sheet String optionalsets: DocumentPath, DocumentUrl**

Worksheet name when using Document.

**-SheetIndex Int32 optionalsets: DocumentPath, DocumentUrl**

Worksheet index (0-based) when using Document.

**-Url String requiredposition: 0sets: DocumentUrl, ContextUrl**

Image URL to download.

## Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see [about_CommonParameters](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters).

Evotec API Reference Copyright 2026 Evotec Services

<!-- PowerForge markdown artifact sha256:64ABAAB6F76D63E37F9E59B14A26E0BCC1419DCCD0350960797E1012704FC0D4 -->
