Cmdlet
Open-OfficeExcel
Opens a workbook for explicit editing, or atomically saves a completed content block.
Syntax
Open-OfficeExcel
[-AllowLoss]
[[-Content] <ScriptBlock>]
[-MaxDegreeOfParallelism <Int32>]
[-PassThru]
[-Password <SecureString>]
[-Path] <String>
[-ReadOnly]
[-SaveOptions <ExcelSaveOptions>]
[-Show]
[<CommonParameters>]#Parameter set:
PathOpen-OfficeExcel
[-AllowLoss]
[[-Content] <ScriptBlock>]
-LiteralPath <String>
[-MaxDegreeOfParallelism <Int32>]
[-PassThru]
[-Password <SecureString>]
[-ReadOnly]
[-SaveOptions <ExcelSaveOptions>]
[-Show]
[<CommonParameters>]#Parameter set:
LiteralPathOpen-OfficeExcel
[-AllowHttp]
[-MaxDegreeOfParallelism <Int32>]
[-Password <SecureString>]
[-ReadOnly]
[-Uri] <Uri>
[<CommonParameters>]#Parameter set:
UriDescription
Opening preserves the workbook's theme and encryption. A failed block leaves its source unchanged. Remote workbooks remain detached; save them with Save-OfficeExcel -Path.
Examples
Open a literal file from the pipeline.
$workbook = Get-Item -LiteralPath './Review[final].xlsx' | Open-OfficeExcel
$workbook | Close-OfficeExcelEdit and save an existing workbook.
Open-OfficeExcel -Path ./Report.xlsx {
ExcelSheet 'Data' { ExcelCell -Address B2 -Value 'Reviewed' }
}Read a detached workbook from HTTPS.
$workbook = Open-OfficeExcel -Uri https://intranet.example.com/Budget.xlsx -ReadOnly
Import-OfficeExcel -Document $workbook -Sheet Budget
Close-OfficeExcel -Document $workbookParameters
- -AllowLoss SwitchParameter
- Explicitly accept native-save reductions in a completed local content block.
- -Content ScriptBlock
- Edit a local workbook and save only after the block completes successfully.
- -MaxDegreeOfParallelism Int32
- Maximum parallel workers; omission preserves the native execution policy.
- -PassThru SwitchParameter
- Return the saved FileInfo from a completed local content block.
- -Password SecureString
- Source password as a SecureString, credential, or warned plaintext value.
- -Path String
- Workbook path with FileSystem wildcard expansion.
- -ReadOnly SwitchParameter
- Return a read-only live workbook; authoring blocks require writable input.
- -SaveOptions ExcelSaveOptions
- Native save options or a hashtable, applied only to a completed local content block.
- -Show SwitchParameter
- Open the saved file in its registered application after a local block completes.
- -LiteralPath String
- Literal workbook path; accepts FileInfo.FullName and provider PSPath.
- -AllowHttp SwitchParameter
- Allow HTTP in addition to HTTPS for a remote workbook.
- -Uri Uri
- HTTP or HTTPS workbook loaded without a local save destination.
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.