When Export-CSV is not enough

Creating richer reports, when Export-CSV is not enough

I needed something more than the simple Export-CSV.  While it is very useful and quick, I needed something that I could add additional worksheets to and be management ready.  I found this code to create an Excel spreadsheet.  I modified the code to be in a function format and to fit my needs.  Now I can export any data from PowerShell into a nicely formatted Excel file.

To add another worksheet, I created another function, AddExcelWorkSheet.  This function looks for the Excel variable from the previous function and adds another worksheet.  It follows the same process as the original function.

Now to export data using the new functions:

. PrettyExcelExport $ExcelSheetName, $ExcelSheetTitle, $Columns, $Data, $filename, $CloseExcel

Example:

 

AD Inventory-Domain

AD Inventory

DC Inventory-Domain

DC Inventory

 Tip:  When exporting the data to Excel using the functions above, export the worksheet you want first, last.

Leave a Reply

Your email address will not be published. Required fields are marked *