API Reference

Cmdlet

New-OfficeExcel

Aliases: ExcelNew

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

Example 1: 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 [-ApplicationName <String>] [-Author <String>] [-AutoSave] [-Category <String>] [-ClearCachedFormulaResults] [-Company <String>] [-Content <ScriptBlock>] [-DateSystem <1900|1904|NineteenHundred|NineteenFour>] [-Description <String>] [-DisableFastPackageWriter] [-DocumentTitle <String>] [-EvaluateFormulas] -FilePath <String> [-ForceFullCalculationOnOpen] [-Keywords <String>] [-LastModifiedBy <String>] [-Manager <String>] [-MarkFormulasDirty] [-NoSave] [-Open] [-PassThru] [-Password <String>] [-PdfPath <String>] [-SafePreflight] [-SafeRepairDefinedNames] [-Subject <String>] [-TemplatePath <String>] [-ValidateOpenXml] [<CommonParameters>]
#
Parameter set: All Parameter Sets

Parameters

ApplicationName String optionalposition: namedpipeline: False
Workbook application-name metadata.
Author String optionalposition: namedpipeline: False
Workbook author metadata.
AutoSave SwitchParameter optionalposition: namedpipeline: False
Opt into OfficeIMO automatic saves during operations.
Category String optionalposition: namedpipeline: False
Workbook category metadata.
ClearCachedFormulaResults SwitchParameter optionalposition: namedpipeline: False
Remove cached formula results before saving.
Company String optionalposition: namedpipeline: False
Workbook company metadata.
Content ScriptBlock optionalposition: 1pipeline: False
DSL scriptblock describing workbook content.
DateSystem String optionalposition: namedpipeline: Falsevalues: 4
Workbook date system for Excel date serials.
Possible values: 1900, 1904, NineteenHundred, NineteenFour
Description String optionalposition: namedpipeline: False
Workbook description metadata.
DisableFastPackageWriter SwitchParameter optionalposition: namedpipeline: False
Disable OfficeIMO fast package writers for this save.
DocumentTitle String optionalposition: namedpipeline: False
Workbook document title metadata.
EvaluateFormulas SwitchParameter optionalposition: namedpipeline: False
Evaluate supported formulas and write cached values before saving.
FilePath String requiredposition: 0pipeline: Falsealiases: Path
Destination path for the workbook.
ForceFullCalculationOnOpen SwitchParameter optionalposition: namedpipeline: False
Request a full workbook recalculation when opened in Excel-compatible applications.
Keywords String optionalposition: namedpipeline: False
Workbook keyword metadata.
LastModifiedBy String optionalposition: namedpipeline: False
Workbook last-modified-by metadata.
Manager String optionalposition: namedpipeline: False
Workbook manager metadata.
MarkFormulasDirty SwitchParameter optionalposition: namedpipeline: False
Mark formula cells dirty before saving.
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.
Password String optionalposition: namedpipeline: False
Password used to save the workbook as an encrypted package.
PdfPath String optionalposition: namedpipeline: False
Optional PDF path to create from the same workbook before closing it.
SafePreflight SwitchParameter optionalposition: namedpipeline: False
Run OfficeIMO worksheet preflight cleanup before saving.
SafeRepairDefinedNames SwitchParameter optionalposition: namedpipeline: False
Repair common defined-name issues before saving.
Subject String optionalposition: namedpipeline: False
Workbook subject metadata.
TemplatePath String optionalposition: namedpipeline: Falsealiases: Template
Optional workbook template package copied before running the DSL.
ValidateOpenXml SwitchParameter optionalposition: namedpipeline: False
Validate the saved package with OpenXmlValidator and throw on errors.