# Set-OfficeExcelChartTrendline

Adds or replaces an Excel chart series trendline. Review available syntax, parameters, pipeline guidance, and reference details in PSWriteOffice API Reference.

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: ExcelChartTrendline

**Module**

`PSWriteOffice`

**Aliases**

`ExcelChartTrendline`

**Inputs**

`OfficeIMO.Excel.ExcelChart`

**Outputs**

`OfficeIMO.Excel.ExcelChart`

**Source**

[SetOfficeExcelChartTrendlineCommand.cs:20](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Excel/SetOfficeExcelChartTrendlineCommand.cs#L20) 

Adds or replaces an Excel chart series trendline.

## Syntax

```
Set-OfficeExcelChartTrendline
[-Backward <Double>]
-Chart <ExcelChart>
[-DisplayEquation]
[-DisplayRSquared]
[-Forward <Double>]
[-Intercept <Double>]
[-LineColor <String>]
[-LineWidthPoints <Double>]
[-Order <Int32>]
[-PassThru]
[-Period <Int32>]
-SeriesIndex <Int32>
-Type <OfficeChartTrendlineType>
[<CommonParameters>]
```

[#](#method-set-officeexcelcharttrendline-double-excelchart-switchparameter-switchparameter-double-double-string-double-int32-switchparameter-int32-int32-officecharttrendlinetype)

Parameter set: `Index`

```
Set-OfficeExcelChartTrendline
[-Backward <Double>]
-Chart <ExcelChart>
[-DisplayEquation]
[-DisplayRSquared]
[-Forward <Double>]
[-IgnoreCase <Boolean>]
[-Intercept <Double>]
[-LineColor <String>]
[-LineWidthPoints <Double>]
[-Order <Int32>]
[-PassThru]
[-Period <Int32>]
-SeriesName <String>
-Type <OfficeChartTrendlineType>
[<CommonParameters>]
```

[#](#method-set-officeexcelcharttrendline-double-excelchart-switchparameter-switchparameter-double-boolean-double-string-double-int32-switchparameter-int32-string-officecharttrendlinetype)

Parameter set: `Name`

## Examples

### Add a polynomial trendline.

```powershell
$chart | Set-OfficeExcelChartTrendline -SeriesIndex 0 -Type Polynomial -Order 2 -DisplayEquation -DisplayRSquared
```

Adds a polynomial trendline to the first series.

## Parameters

**-Backward Double optional**

Backward forecast units.

**-Chart ExcelChart requiredpipeline: True (ByValue)**

Chart to update.

**-DisplayEquation SwitchParameter optional**

Display the trendline equation.

**-DisplayRSquared SwitchParameter optional**

Display the R-squared value.

**-Forward Double optional**

Forward forecast units.

**-Intercept Double optional**

Trendline intercept.

**-LineColor String optional**

Trendline line color. Named colors and hexadecimal values are accepted.

**-LineWidthPoints Double optional**

Trendline line width in points.

**-Order Int32 optional**

Polynomial order.

**-PassThru SwitchParameter optional**

Emit the object created or changed by the command.

**-Period Int32 optional**

Moving-average period.

**-SeriesIndex Int32 requiredsets: Index**

Zero-based series index.

**-Type OfficeChartTrendlineType required**

Trendline type.

Possible values: `Exponential`, `Linear`, `Logarithmic`, `MovingAverage`, `Polynomial`, `Power`

**-IgnoreCase Boolean optionalsets: Name**

Ignore case when matching series name.

**-SeriesName String requiredsets: Name**

Series name.

## 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:4942264EE797B37DA348F9BCDB7C8E93B7DDB8EBD56119D0581AB440B399557B -->
