Evotec

Project

PSWriteOffice

PSWriteOffice is an open-source PowerShell and .NET project with packages, release history, and technical documentation.

Stars 144
Forks 12
Open issues 16
PowerShell Gallery downloads 150,904
Release v0.2.0
Language: C# Updated: 2026-04-06

API Reference

Cmdlet

New-OfficeExcel

Namespace PSWriteOffice
Inputs
None
Outputs
System.Object

Creates a new Excel workbook using the DSL.

Remarks

Runs the provided script block inside an ExcelSheet/ExcelCell DSL context and saves the file.

Examples

Authored help example

Create a workbook with a sheet and a few cells.

PS>


New-OfficeExcel -Path .\report.xlsx { ExcelSheet 'Data' { ExcelCell -Address 'A1' -Value 'Region' } }
        

Creates report.xlsx and writes “Region” into cell A1 on the Data worksheet.

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

New-OfficeExcel [-AutoSave] [-Content <ScriptBlock>] -FilePath <String> [-NoSave] [-Open] [-PassThru] [<CommonParameters>]
#
Parameter set: All Parameter Sets

Parameters

AutoSave SwitchParameter optionalposition: namedpipeline: False
Opt into OfficeIMO automatic saves during operations.
Content ScriptBlock optionalposition: 1pipeline: False
DSL scriptblock describing workbook content.
FilePath String requiredposition: 0pipeline: Falsealiases: Path
Destination path for the workbook.
NoSave SwitchParameter optionalposition: namedpipeline: False
Skip saving the workbook after running the DSL.
Open SwitchParameter optionalposition: namedpipeline: False
Open the workbook in Excel after saving.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit a FileInfo for convenience.

Outputs

System.Object