Project

PSWriteOffice

PowerShell document automation across Word, Excel, PowerPoint, PDF, Reader, Confluence, Visio, and open text formats.

Stars 159
Forks 14
PowerShell Gallery downloads 158,661
Release v3.0.5
Language: C# Updated: 2026-09-03

API Reference

Cmdlet

Copy-OfficeExcelWorkbook

Aliases: ExcelPackageCopy, ExcelWorkbookCopy
Namespace PSWriteOffice
Aliases
ExcelPackageCopy ExcelWorkbookCopy
Inputs
None
Outputs
System.IO.FileInfo

Copies a workbook package while preserving package parts.

Remarks

Copies a workbook package while preserving package parts.

Examples

Authored help example

Copy a workbook package and return the copied file.

PS>


$copy = Copy-OfficeExcelWorkbook -Path .\Template.xlsx -DestinationPath .\Report.xlsx -Force -PassThru
            Test-OfficeExcelWorkbook -Path $copy.FullName -SkipOpenXmlValidation |
                Select-Object Passed, WorksheetCount
        

Copies the workbook package and normalizes the workbook content type for the destination extension.

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

Copy-OfficeExcelWorkbook -DestinationPath <String> [-Force] [-PassThru] -Path <String> [<CommonParameters>]
#
Parameter set: All Parameter Sets

Parameters

DestinationPath String requiredposition: 1pipeline: Falsealiases: Destination, OutputPath, TargetPath
Destination workbook path.
Force SwitchParameter optionalposition: namedpipeline: False
Replace an existing destination workbook.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit a FileInfo for the copied workbook.
Path String requiredposition: 0pipeline: Falsealiases: FilePath, InputPath, SourcePath
Source workbook or template package path.

Outputs

System.IO.FileInfo