# Add-OfficeExcelTableOfContents

Adds or refreshes a workbook table of contents sheet.

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

Forks **84**

Open issues **7**

Total downloads **5,275,783**

Release **OfficeIMO-v3.6.2**

Language: C# Updated: 2026-11-24

Cmdlet 

Aliases: ExcelTableOfContents

**Module**

`PSWriteOffice`

**Aliases**

`ExcelTableOfContents`

**Inputs**

`OfficeIMO.Excel.ExcelDocument`

**Outputs**

`OfficeIMO.Excel.ExcelDocument` `System.IO.FileInfo`

**Source**

[AddOfficeExcelTableOfContentsCommand.cs:24](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Excel/AddOfficeExcelTableOfContentsCommand.cs#L24) 

Adds or refreshes a workbook table of contents sheet.

## Syntax

```
Add-OfficeExcelTableOfContents
[-AddBackLinks]
[-BackLinkColumn <Int32>]
[-BackLinkRow <Int32>]
[-BackLinkText <String>]
[-DoNotPlaceFirst]
[-IncludeHiddenNamedRanges]
[-IncludeNamedRanges]
[-NoHyperlinks]
[-NoStyle]
[-Open]
[-PassThru]
[-SheetName <String>]
[<CommonParameters>]
```

[#](#method-add-officeexceltableofcontents-switchparameter-int32-int32-string-switchparameter-switchparameter-switchparameter-switchparameter-switchparameter-switchparameter-switchparameter-string)

Parameter set: `Context`

```
Add-OfficeExcelTableOfContents
[-AddBackLinks]
[-BackLinkColumn <Int32>]
[-BackLinkRow <Int32>]
[-BackLinkText <String>]
[-DoNotPlaceFirst]
[-IncludeHiddenNamedRanges]
[-IncludeNamedRanges]
[-NoHyperlinks]
[-NoStyle]
[-Open]
[-PassThru]
[-Path] <String>
[-SheetName <String>]
[<CommonParameters>]
```

[#](#method-add-officeexceltableofcontents-switchparameter-int32-int32-string-switchparameter-switchparameter-switchparameter-switchparameter-switchparameter-switchparameter-switchparameter-string-string)

Parameter set: `Path`

```
Add-OfficeExcelTableOfContents
[-AddBackLinks]
[-BackLinkColumn <Int32>]
[-BackLinkRow <Int32>]
[-BackLinkText <String>]
-Document <ExcelDocument>
[-DoNotPlaceFirst]
[-IncludeHiddenNamedRanges]
[-IncludeNamedRanges]
[-NoHyperlinks]
[-NoStyle]
[-Open]
[-PassThru]
[-SheetName <String>]
[<CommonParameters>]
```

[#](#member-b38f797e6846741dccbe12b9)

Parameter set: `Document`

## Description

Can run inside the Excel DSL, against an open workbook, or directly against a file path.

## Examples

### Add a TOC sheet and verify workbook structure.

```powershell
$proof = @(
    Add-OfficeExcelTableOfContents -Path .\report.xlsx -IncludeNamedRanges -AddBackLinks -PassThru
    Get-OfficeExcelSummary -Path .\report.xlsx -IncludeSheets |
        Select-Object -Property SheetCount, NamedRangeCount, Sheets
)
$proof
```

Creates or refreshes a TOC sheet, adds back links, and reads back workbook navigation metadata.

## Parameters

**-AddBackLinks SwitchParameter optional**

Add a quick link back to the TOC on each worksheet.

**-BackLinkColumn Int32 optional**

Column for the back link when AddBackLinks is used.

**-BackLinkRow Int32 optional**

Row for the back link when AddBackLinks is used.

**-BackLinkText String optional**

Text used for back links.

**-DoNotPlaceFirst SwitchParameter optional**

Keep the TOC sheet in its current position instead of moving it first.

**-IncludeHiddenNamedRanges SwitchParameter optional**

Include hidden named ranges when listing named ranges.

**-IncludeNamedRanges SwitchParameter optional**

Include named ranges in the TOC.

**-NoHyperlinks SwitchParameter optional**

Disable internal hyperlinks in the TOC sheet.

**-NoStyle SwitchParameter optional**

Disable formatted TOC styling.

**-Open SwitchParameter optional**

Open the workbook after saving when Path is used.

**-PassThru SwitchParameter optional**

Emit the updated document or file info.

**-SheetName String optional**

Name of the TOC sheet.

**-Path String requiredposition: 0aliases: FilePath, InputPathsets: Path**

Path to the workbook to update in place.

**-Document ExcelDocument requiredpipeline: True (ByValue)sets: Document**

Workbook to update.

## 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:0D1385D50145AB8E03BF4AFE1876F6CAC9D493B4D1D8BF2B0A05E1CF83760B17 -->
