Skip to main content

Update Table of Contents in Word with Power Automate

PDF4me Update Table of Contents is a Power Automate action that scans a Word document's headings and generates or refreshes its Table of Contents automatically. Use it to add professional, clickable navigation to technical manuals, academic papers, or long reports the moment a document lands in a flow, without opening Word.

What this action does

PDF4me Update Table of Contents reads a Word document's Heading 1 through Heading 6 styles within a configured range, then updates an existing TOC field or creates a new one at the document's start, with control over hyperlinks, tab leaders, letter case, and locale.

Related Blog Posts
No blog post yet for this feature — coming soon.
In the meantime, browse the PDF4me blog for tutorials and workflows across every platform.
Visit the blog

Authenticating Your API Request

To access the PDF4me Web API through Power Automate, every request must include a valid API key. Authentication validates your identity and enables the connector to reach PDF4me's Word TOC service from your flow.

Important Facts You Should Not Miss

Updates an existing TOC or creates one
The action scans for an existing TOC field first. If none exists, it inserts a new one at the start of the document with a "Table of Contents" title.
Three fields are grouped as Advanced parameters
Hide Tab Leader, Use Uppercase, and Culture Name sit behind the connector's Advanced parameters toggle, not on the main form.
Heading Levels supports ranges and multiple ranges
Use "1-3" for a range, "1" for a single level, or "1-2,4-6" to combine non-adjacent ranges in one TOC.
Power Automate PDF4me Word Update Table of Contents action showing File Content, File Name, Heading Levels, Use Hyperlinks, and the Advanced parameters panel

File Content, File Name, Heading Levels, and Use Hyperlinks sit on the main form; Hide Tab Leader, Use Uppercase, and Culture Name are Advanced parameters.

Parameters

Required: File Content and File Name must always be provided. Heading Levels and Use Hyperlinks carry working defaults, and Hide Tab Leader, Use Uppercase, and Culture Name are Optional Advanced parameters.

ParameterRequiredWhat it doesExample
File ContentRequiredBase64 content of the source Word file, typically mapped from a prior action like SharePoint or OneDrive Get File Content. Must be a valid .docx or .doc document.[File Content from Get File]
File NameRequiredName of the Word file including its extension, used for processing and output naming; the output filename matches the input.document.docx
Heading LevelsOptionalRange of Word heading styles to include, for example "1-3" for levels 1 through 3, "1" for a single level, or "1-2,4-6" for combined ranges. Defaults to "1-3".1-3
Use HyperlinksOptionalYes makes TOC entries clickable links to their headings; No renders plain text entries. Defaults to Yes.Yes
Hide Tab LeaderOptionalAdvanced parameter. Yes removes the dotted line between entry text and page numbers; No keeps it. Defaults to Yes.Yes
Use UppercaseOptionalAdvanced parameter. Yes renders all TOC entries in uppercase; No preserves the heading's original case. Defaults to Yes.Yes
Culture NameOptionalAdvanced parameter. Locale code such as en-US or de-DE for document processing and metadata; leave blank for no culture-specific handling.en-US

What Does Update Table of Contents Return?

FieldTypeWhat it contains
documentBase64Word document with the Table of Contents updated or newly created.
SuccessBooleantrue when the update completed, false if the request failed validation or processing.
Error MessageStringDescription of what went wrong, null when Success is true.
ErrorsArrayDetailed error entries, empty when Success is true.
{
"document": "[Base64 Word Content with Updated Table of Contents]",
"Success": true,
"ErrorMessage": null,
"Errors": []
}

Common Error Messages

Error MessageCauseSolution
Request is emptyRequest object is null.Provide a valid request object.
Document is emptyDocument object is null.Provide a valid Word document.
Error loading document from bytesInvalid or corrupted Word document.Verify the input document is a valid Word file (.docx).
No headings found in documentDocument has no heading styles applied.Apply Heading 1 through Heading 6 styles to the sections that should appear in the TOC.
Invalid heading levels specifiedHeading Levels contains an invalid format.Use a valid format such as "1-3", "1", or "1-2,4-6".
Invalid culture name providedCulture Name is not a recognized locale.Use a valid culture code such as en-US or fr-FR.

How Do I Set Up Update Table of Contents in Power Automate?

  1. Add PDF4meUpdate Table of Contents to your Power Automate flow.
  2. Map File Content and File Name from a previous action, such as SharePoint or OneDrive Get File Content.
  3. Set Heading Levels to the range of heading styles to include, and Use Hyperlinks to control whether entries are clickable.
  4. Open Advanced parameters if the document needs a non-default tab leader, letter case, or a specific Culture Name locale.
  5. Run the flow. PDF4me updates or creates the TOC and returns the Word document as document.

What Heading Levels Range Should I Use?

Use "1-3", the default, for most business documents and reports, since it captures section and subsection headings without pulling in minor sub-subheadings. Use a wider range like "1-6" for complex legal or technical documents where deep nesting needs to be navigable. Use combined ranges like "1-2,4-6" when a document's level-3 headings are decorative or repetitive and should be skipped while still capturing the deeper structure below them.

Typical Setups

Workflow ExamplesCommon Power Automate flow patterns using Update Table of Contents.
Automated technical manual indexing
  1. A flow triggers when a technical manual is uploaded to a SharePoint "Manuals" library.
  2. Get File retrieves the uploaded Word document.
  3. Update Table of Contents runs with Heading Levels set to "1-4" and Use Hyperlinks set to Yes.
  4. The indexed manual is saved back to the library, ready for readers to jump between sections.
Academic paper formatting standard
  1. A research paper submission flow receives a new manuscript.
  2. Update Table of Contents runs with Heading Levels "1-3", Hide Tab Leader Yes, and Use Uppercase Yes to match the department's formatting standard.
  3. The standardized paper is routed to the review committee for evaluation.
Localized document distribution
  1. An international document flow prepares a translated Word file for a regional office.
  2. Update Table of Contents runs with Culture Name set to the target locale, for example "de-DE", alongside the standard Heading Levels and Use Hyperlinks settings.
  3. The localized, navigable document is distributed to the regional team.

Practical Tips

Apply real Word heading styles before running the action
The TOC is built from Word's Heading 1 through Heading 6 styles, not from bold text or larger font sizes. A document with no styled headings returns a "no headings found" error.
Open Advanced parameters to reach three of the seven fields
Hide Tab Leader, Use Uppercase, and Culture Name are not on the connector's main form. Expand Advanced parameters in the designer to set them.
Test the Heading Levels format on one document first
A malformed range like "1,3" instead of "1-3" or "1,3-4" returns an invalid heading levels error. Confirm the format on a sample file before wiring it into a production flow.
Re-run on documents with an existing TOC to refresh page numbers
The action detects and updates an existing TOC field rather than duplicating one, so it is safe to re-run after content changes shift page numbers.
Match Culture Name to the document's actual language
An unrecognized or mismatched culture code returns an invalid culture name error; use standard codes like en-US or fr-FR rather than a free-text language name.

Cheat Sheet

FieldValue
ActionUpdate Table of Contents
File Content / File NameMapped from a prior action, .docx or .doc
Heading Levels"1-3" default, or "1", or "1-2,4-6"
Use HyperlinksYes (default) or No
Advanced: Hide Tab LeaderYes (default) or No
Advanced: Use UppercaseYes (default) or No
Advanced: Culture Namee.g. en-US, de-DE, blank for none
No headings foundApply Word Heading 1-6 styles first
Outputdocument (Base64 Word), Success, Error Message, Errors

Common Questions

How do I automatically generate a Table of Contents in Word with Power Automate?+
Add the PDF4me Update Table of Contents action, map File Content and File Name from a prior action, then set Heading Levels to the range of heading styles to include, for example 1-3. The action scans the document's headings, updates an existing TOC field or creates a new one, and returns the updated Word file.
What happens if the document does not already have a Table of Contents?+
The action creates a new Table of Contents at the start of the document, adding a "Table of Contents" title in the Heading1 style, built from the headings that fall within the configured Heading Levels range.
Which Word heading styles does the Table of Contents pick up?+
The action reads Word's built-in Heading 1 through Heading 6 styles. Heading Levels controls which of those levels are included, using a range like 1-3, a single level like 1, or multiple ranges like 1-2,4-6.
Can I control hyperlinks, tab leaders, and letter case in the generated TOC?+
Yes. Use Hyperlinks makes TOC entries clickable links to their headings. The Advanced parameters Hide Tab Leader control the dotted line between entry text and page numbers, and Use Uppercase controls whether entries render in uppercase or their original case.
What is the Culture Name parameter for?+
Culture Name sets a locale such as en-US or de-DE for document processing and metadata, useful when generating a Table of Contents for a localized or multi-language document. See <a href="https://learn.microsoft.com/en-us/globalization/locale/locale-names" target="_blank" rel="noopener noreferrer">Microsoft's locale name reference</a> for valid culture codes.
Is there a similar action for headers and footers instead of a TOC?+
Yes, see the PDF4me Update Headers Footers action linked under Related Actions below. See <a href="https://learn.microsoft.com/en-us/connectors/pdf4meconnect/" target="_blank" rel="noopener noreferrer">the PDF4me Power Automate connector reference</a> for the full action list.

Industry Use Cases & Applications

Legal Industry Use Cases

  • Contract Navigation: Generate a detailed TOC for complex, multi-section contracts
  • Legal Briefs: Create a navigable structure for lengthy court documents
  • Compliance Manuals: Index regulatory requirements and procedures
  • Case Documentation: Organize evidence summaries and legal arguments

Same Task on Other Platforms

Get Help