Project

PSWriteOffice

PowerShell document automation across OfficeIMO's document, spreadsheet, presentation, PDF, Project, Access, EPUB, invoicing, and conversion engines.

Stars 654
Forks 82
Open issues 1
Total downloads 4,320,051
Release OfficeIMO-v3.5.3
Language: C# Updated: 2026-11-03
Cmdlet

Copy-OfficeExcelWorkbook

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

Copies a workbook package while preserving package parts.

Syntax

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

Examples

Copy a workbook package and return the copied file.

$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.

Parameters

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

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.