# Add-OfficeExcelChart

Adds a chart to the current worksheet using a range or table.

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 **3**

Total downloads **5,231,343**

Release **OfficeIMO-v3.6.2**

Language: C# Updated: 2026-11-23

Cmdlet 

Aliases: ExcelChart

**Module**

`PSWriteOffice`

**Aliases**

`ExcelChart`

**Inputs**

`OfficeIMO.Excel.ExcelDocument`

**Source**

[AddOfficeExcelChartCommand.cs:23](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Excel/AddOfficeExcelChartCommand.cs#L23) 

Adds a chart to the current worksheet using a range or table.

## Syntax

```
Add-OfficeExcelChart
-Column <Int32>
[-HasHeaders <Boolean>]
[-HeightPixels <Int32>]
[-IncludeCachedData <Boolean>]
[-PassThru]
[-Range] <String>
-Row <Int32>
[-Title <String>]
[-Type <ExcelChartType>]
[-WidthPixels <Int32>]
[<CommonParameters>]
```

[#](#method-add-officeexcelchart-int32-boolean-int32-boolean-switchparameter-string-int32-string-excelcharttype-int32)

Parameter set: `ContextRange`

```
Add-OfficeExcelChart
-Column <Int32>
-Document <ExcelDocument>
[-HasHeaders <Boolean>]
[-HeightPixels <Int32>]
[-IncludeCachedData <Boolean>]
[-PassThru]
[-Range] <String>
-Row <Int32>
[-Sheet <String>]
[-SheetIndex <Int32>]
[-Title <String>]
[-Type <ExcelChartType>]
[-WidthPixels <Int32>]
[<CommonParameters>]
```

[#](#method-add-officeexcelchart-int32-exceldocument-boolean-int32-boolean-switchparameter-string-int32-string-int32-string-excelcharttype-int32)

Parameter set: `DocumentRange`

```
Add-OfficeExcelChart
-Column <Int32>
-Document <ExcelDocument>
[-HeightPixels <Int32>]
[-IncludeCachedData <Boolean>]
[-PassThru]
-Row <Int32>
[-Sheet <String>]
[-SheetIndex <Int32>]
[-TableName] <String>
[-Title <String>]
[-Type <ExcelChartType>]
[-WidthPixels <Int32>]
[<CommonParameters>]
```

[#](#method-add-officeexcelchart-int32-exceldocument-int32-boolean-switchparameter-int32-string-int32-string-string-excelcharttype-int32)

Parameter set: `DocumentTable`

```
Add-OfficeExcelChart
-Column <Int32>
[-HeightPixels <Int32>]
[-IncludeCachedData <Boolean>]
[-PassThru]
-Row <Int32>
[-TableName] <String>
[-Title <String>]
[-Type <ExcelChartType>]
[-WidthPixels <Int32>]
[<CommonParameters>]
```

[#](#method-add-officeexcelchart-int32-int32-boolean-switchparameter-int32-string-string-excelcharttype-int32)

Parameter set: `ContextTable`

## Examples

### Add a chart from a range.

```powershell
ExcelSheet 'Data' { Add-OfficeExcelChart -Range 'A1:D10' -Row 2 -Column 6 -Type Line -Title 'Trend' }
```

Creates a line chart from A1:D10 and places it at F2.

### Add a chart from a table.

```powershell
ExcelSheet 'Data' { Add-OfficeExcelChart -TableName 'Sales' -Row 2 -Column 6 -Type ColumnClustered }
```

Creates a chart from the Sales table.

## Parameters

**-Column Int32 required**

Top-left column (1-based) where the chart should be placed.

**-HasHeaders Boolean optionalsets: ContextRange, DocumentRange**

Whether the range includes headers.

**-HeightPixels Int32 optional**

Chart height in pixels.

**-IncludeCachedData Boolean optional**

Include cached data in the chart for portability.

**-PassThru SwitchParameter optional**

Emit the created chart.

**-Range String requiredposition: 0sets: ContextRange, DocumentRange**

A1 range containing chart data.

**-Row Int32 required**

Top-left row (1-based) where the chart should be placed.

**-Title String optional**

Chart title.

**-Type ExcelChartType optional**

Chart type.

Possible values: `ColumnClustered`, `ColumnStacked`, `ColumnStacked100`, `Column3DClustered`, `Column3DStacked`, `Column3DStacked100`, `BarClustered`, `BarStacked`, `BarStacked100`, `Bar3DClustered`, `Bar3DStacked`, `Bar3DStacked100`, `Line`, `LineStacked`, `LineStacked100`, `Line3D`, `Area`, `AreaStacked`, `AreaStacked100`, `Area3D`, `Area3DStacked`, `Area3DStacked100`, `Pie`, `Pie3D`, `PieOfPie`, `BarOfPie`, `Doughnut`, `Scatter`, `Bubble`, `Radar`, `Stock`, `Surface`, `SurfaceWireframe`, `SurfaceContour`, `SurfaceContourWireframe`

**-WidthPixels Int32 optional**

Chart width in pixels.

**-Document ExcelDocument requiredpipeline: True (ByValue)sets: DocumentRange, DocumentTable**

Workbook to operate on outside the DSL context.

**-Sheet String optionalsets: DocumentRange, DocumentTable**

Worksheet name when using Document.

**-SheetIndex Int32 optionalsets: DocumentRange, DocumentTable**

Worksheet index (0-based) when using Document.

**-TableName String requiredposition: 0sets: DocumentTable, ContextTable**

Table name containing chart data.

## 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:149B33DAE6826D13F5C1ED955E85D34DB3C75CC1A6635D65E8691D38D5ACB76D -->
