Changed Export-Excel.ps1
#1 @ Line 197 Made new parameter sets . Default, and table already
existed and use path. Added DefaultPackage and TablePackage
A New parameter "Package" allows an ExcelPackage object returned by
-passThru to be passed in
~Line 400 code to use package or path depending on path passed.
(also added Open-ExcelPackage to get the object without exporting and
Close-ExcelPackage to close it nicely - these are in their own file)
#2. @ Line 256 added new parameter excludeProperty to remove unwanted
properties without needing to go through select-object
~Line 459 added logic to exclude the properties specified in the new
parameter
#3 . @ Line 262 Added new parameter Append
~Line 420 code to read the existing headers and move the insertion point
below the current data
(normal behaviour is to check if headers exist when adding data in the
process block, which makes this change wonderfully easy)
~Line 510 changed basis for identifying named ranges and changed scope
for rangeName so it can be used on other sheets
#4. ~Line 550. Remove any existing Pivot table before trying to
[re]create it.
Added formatting.ps1 which applies conditional and normal formats -
requires an ExcelPackage to be open.
Added Open-ExcelPackage.ps1 (which contains a close function as well to
get the the object and save it ) open allows the sheet to be loaded
into a package object without needing to export .
Updated .psm1 to add the formating and open/close ps1 files.
- Renamed 'TopRow' to 'StartRow' and added alias
(More concise with future parameter names like 'StartColumn')
- Removed 'ChangeList' in 'Notes' as this is tracked in Git
- Added parameter 'Password' to import password protected files
- Added Pester tests for parameter aliasses and:
- parameter 'Password'
- parameter 'Path' validation for extensions '.xls' and '.xlsx'
- 'HeaderName' witb blanks
- Changed comments in Pester tests from '<# Comment #>' to '# Comment'
(Easier to outcomment a whole block of tests when performing a test on a specific piece of code)
- Added parameter sets for proper parameter validation and to make sure '-NoHeader' and '-HeaderRow' aren't used together
- Added try/catch clause, CmdLetBinding and verbose messages
- Renamed 'HeaderRow' to 'TopRow' to avoid confusion with other parameters
- Renamed '-Header' to '-HeaderName'
- Added test for duplicate property names
- Added test for empty worksheet
- Added test for no data after TopRow
- Fixed incorrect import when there's no value in the first column
- Fixed values being imported under the wrong property name in case one
- Fixed incorrect import in case column A is empty and B and C not ( '$Worksheet.Dimension.Columns' is unreliable because it will say 2 columns are in use while it should say 3).
(Ex. Add data in cell B2 and C2, use the '-NoHeader' switch, notice P1 and P2 are incorrectly blanc.)
Created a ValidateSet for Encoding and Extension. removed Extension from the params. Removed Encoding at the Export-Csv as it is already included in params