Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Import-OfficeToml

Module
PSWriteOffice
Inputs
System.String[]
Outputs
System.Management.Automation.PSObject System.Collections.Specialized.OrderedDictionary

Reads TOML files as PowerShell objects; the file form of ConvertFrom-OfficeToml.

Syntax

Import-OfficeToml
[-AsHashtable]
[-Depth <Int32>]
[-Path] <String[]>
[-Untrusted]
[<CommonParameters>]
#
Parameter set: Path
Import-OfficeToml
[-AsHashtable]
[-Depth <Int32>]
-LiteralPath <String[]>
[-Untrusted]
[<CommonParameters>]
#
Parameter set: LiteralPath

Description

Output follows ConvertFrom-OfficeToml: tables become PSCustomObjects in file order, or ordered hashtables with AsHashtable. A file that fails to parse writes a non-terminating error with the engine's code, line and column, and the next file is read.

Examples

Read a tool's settings.

$ruff = (Import-OfficeToml -Path ./pyproject.toml).tool.ruff
$ruff.'line-length'

Read the manifest of every crate under a folder.

Get-ChildItem ./crates -Filter Cargo.toml -Recurse | Import-OfficeToml | ForEach-Object { $_.package.name }

Parameters

-AsHashtable SwitchParameter optional
Return tables as ordered hashtables instead of PSCustomObjects.
-Depth Int32 optional
Deepest nesting of tables and arrays to accept; sets the reader's MaxDepth.
-Path String[] requiredposition: 0pipeline: True (ByValue)sets: Path
TOML files with FileSystem wildcard expansion.
-Untrusted SwitchParameter optional
Caps every limit at the engine's untrusted defaults, for files from outside.
-LiteralPath String[] requiredpipeline: True (ByPropertyName)aliases: FullName, PSPathsets: LiteralPath
Literal TOML files, including FileInfo.FullName and provider PSPath.

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.