API Reference
Cmdlet
Copy-OfficeExcelWorkbook
Copies a workbook package while preserving package parts.
Remarks
Copies a workbook package while preserving package parts.
Examples
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> -FilePath <String> [-Force] [-PassThru] [<CommonParameters>]#Parameter set:
All Parameter SetsParameters
- DestinationPath String
- Destination workbook path.
- FilePath String
- Source workbook or template package path.
- Force SwitchParameter
- Replace an existing destination workbook.
- PassThru SwitchParameter
- Emit a FileInfo for the copied workbook.
Outputs
System.IO.FileInfo