API Reference
Cmdlet
Add-OfficeExcelTableOfContents
Adds or refreshes a workbook table of contents sheet.
Remarks
Can run inside the Excel DSL, against an open workbook, or directly against a file path.
Examples
Example 1: Add a TOC sheet and verify workbook structure.
PS>
$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.
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.
Syntax
Add-OfficeExcelTableOfContents [-AddBackLinks] [-BackLinkColumn <Int32>] [-BackLinkRow <Int32>] [-BackLinkText <String>] [-DoNotPlaceFirst] [-IncludeHiddenNamedRanges] [-IncludeNamedRanges] [-NoHyperlinks] [-NoStyle] [-Open] [-PassThru] [-SheetName <String>] [<CommonParameters>]#Parameter set:
ContextParameters
- AddBackLinks SwitchParameter
- Add a quick link back to the TOC on each worksheet.
- BackLinkColumn Int32
- Column for the back link when AddBackLinks is used.
- BackLinkRow Int32
- Row for the back link when AddBackLinks is used.
- BackLinkText String
- Text used for back links.
- DoNotPlaceFirst SwitchParameter
- Keep the TOC sheet in its current position instead of moving it first.
- IncludeHiddenNamedRanges SwitchParameter
- Include hidden named ranges when listing named ranges.
- IncludeNamedRanges SwitchParameter
- Include named ranges in the TOC.
- NoHyperlinks SwitchParameter
- Disable internal hyperlinks in the TOC sheet.
- NoStyle SwitchParameter
- Disable formatted TOC styling.
- Open SwitchParameter
- Open the workbook after saving when InputPath is used.
- PassThru SwitchParameter
- Emit the updated document or file info.
- SheetName String
- Name of the TOC sheet.
Outputs
OfficeIMO.Excel.ExcelDocument, System.IO.FileInfo
Add-OfficeExcelTableOfContents [-AddBackLinks] [-BackLinkColumn <Int32>] [-BackLinkRow <Int32>] [-BackLinkText <String>] [-DoNotPlaceFirst] [-IncludeHiddenNamedRanges] [-IncludeNamedRanges] -InputPath <String> [-NoHyperlinks] [-NoStyle] [-Open] [-PassThru] [-SheetName <String>] [<CommonParameters>]#Parameter set:
PathParameters
- AddBackLinks SwitchParameter
- Add a quick link back to the TOC on each worksheet.
- BackLinkColumn Int32
- Column for the back link when AddBackLinks is used.
- BackLinkRow Int32
- Row for the back link when AddBackLinks is used.
- BackLinkText String
- Text used for back links.
- DoNotPlaceFirst SwitchParameter
- Keep the TOC sheet in its current position instead of moving it first.
- IncludeHiddenNamedRanges SwitchParameter
- Include hidden named ranges when listing named ranges.
- IncludeNamedRanges SwitchParameter
- Include named ranges in the TOC.
- InputPath String
- Path to the workbook to update in place.
- NoHyperlinks SwitchParameter
- Disable internal hyperlinks in the TOC sheet.
- NoStyle SwitchParameter
- Disable formatted TOC styling.
- Open SwitchParameter
- Open the workbook after saving when InputPath is used.
- PassThru SwitchParameter
- Emit the updated document or file info.
- SheetName String
- Name of the TOC sheet.
Outputs
OfficeIMO.Excel.ExcelDocument, System.IO.FileInfo
Add-OfficeExcelTableOfContents [-AddBackLinks] [-BackLinkColumn <Int32>] [-BackLinkRow <Int32>] [-BackLinkText <String>] -Document <ExcelDocument> [-DoNotPlaceFirst] [-IncludeHiddenNamedRanges] [-IncludeNamedRanges] [-NoHyperlinks] [-NoStyle] [-Open] [-PassThru] [-SheetName <String>] [<CommonParameters>]#Parameter set:
DocumentParameters
- AddBackLinks SwitchParameter
- Add a quick link back to the TOC on each worksheet.
- BackLinkColumn Int32
- Column for the back link when AddBackLinks is used.
- BackLinkRow Int32
- Row for the back link when AddBackLinks is used.
- BackLinkText String
- Text used for back links.
- Document ExcelDocument
- Workbook to update.
- DoNotPlaceFirst SwitchParameter
- Keep the TOC sheet in its current position instead of moving it first.
- IncludeHiddenNamedRanges SwitchParameter
- Include hidden named ranges when listing named ranges.
- IncludeNamedRanges SwitchParameter
- Include named ranges in the TOC.
- NoHyperlinks SwitchParameter
- Disable internal hyperlinks in the TOC sheet.
- NoStyle SwitchParameter
- Disable formatted TOC styling.
- Open SwitchParameter
- Open the workbook after saving when InputPath is used.
- PassThru SwitchParameter
- Emit the updated document or file info.
- SheetName String
- Name of the TOC sheet.
Outputs
OfficeIMO.Excel.ExcelDocument, System.IO.FileInfo