< Back

Close-ExcelPackage

Wed Jan 15, 2020 12:23 am

NAME Close-ExcelPackage



SYNOPSIS

Closes an Excel Package, saving, saving under a new name or abandoning changes and opening the file in Excel as

required.





SYNTAX

Close-ExcelPackage [-ExcelPackage] <ExcelPackage> [[-SaveAs] <Object>] [[-Password] <String>] [-Show] [-NoSave]

[-Calculate] [<CommonParameters>]





DESCRIPTION

When working with an ExcelPackage object, the Workbook is held in memory and not saved until the .Save() method of

the package is called.



Close-ExcelPackage saves and disposes of the Package object.



It can be called with -NoSave to abandon the file without saving, with a new "SaveAs" filename, and/or with a

password to protect the file. And -Show will open the file in Excel; -Calculate will try to update the workbook,

although not everything can be recalculated





PARAMETERS

-ExcelPackage <ExcelPackage>

Package to close.



Required? true

Position? 1

Default value None

Accept pipeline input? True (ByValue)

Accept wildcard characters? false



-Show [<SwitchParameter>]

Open the file in Excel.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-NoSave [<SwitchParameter>]

Abandon the file without saving.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-SaveAs <Object>

Save file with a new name (ignored if -NoSave Specified).



Required? false

Position? 2

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Password <String>

Password to protect the file.



Required? false

Position? 3

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Calculate [<SwitchParameter>]

Attempt to recalculation the workbook before saving



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



NOTES









-------------------------- EXAMPLE 1 --------------------------



Close-ExcelPackage -show $excel



$excel holds a package object, this saves the workbook and loads it into Excel.

-------------------------- EXAMPLE 2 --------------------------



Close-ExcelPackage -NoSave $excel



$excel holds a package object, this disposes of it without writing it to disk.



RELATED LINKS





CommonParameters : True

WorkflowCommonParameters : False

details : @{name=ColumnChart; noun=; verb=}

Syntax : @{syntaxItem=System.Object[]}

parameters : @{parameter=System.Object[]}

inputTypes : @{inputType=}

returnValues : @{returnValue=}

aliases : None



remarks : None

alertSet :

description :

examples :

Synopsis :

ColumnChart [[-targetData] <Object>] [[-title] <Object>] [[-ChartType] <eChartType>]

[-NoLegend] [-ShowCategory] [-ShowPercent] [<CommonParameters>]



ModuleName : ImportExcel

nonTerminatingErrors :

xmlns:command : http://schemas.microsoft.com/maml/dev/command/2004/10

xmlns:dev : http://schemas.microsoft.com/maml/dev/2004/10

xmlns:maml : http://schemas.microsoft.com/maml/2004/10

Name : ColumnChart

Category : Function

Component :

Role :

Functionality :