Functions, Learning your way around., Powershell, Scripting Technique

PowerShell Importing Data from Excel

If you want to import Excel data I recommend giving the people who toke the time to develop this module Import-Excel. It can be Read about on the PSGallery here: https://www.powershellgallery.com/packages/ImportExcel/

After reading we will try to find the module using built im module package for powershell :

“find-module importexcel”

we can pipe this into an “install-module” command with a few parameters to ensure a smooth install.

find-module importexcel | install-module -Scope CurrentUser -SkipPublisherCheck

this should install the module and you import Excel workbooks as easily as you can excel and text files.

Import-Excel, Export-Excel with a few extra parameters like -worksheet so you can target data sets and even write reports with details on different pages!

I use this to write share permission reports with different shares on different worksheets. So other things you can do is a security audit on servers and write a server to each worksheet and then write a pivot table for a summary report.

I how you download and support this module because it is nothing short of amazing, you dont have to have the excel application installed to import or export to Excel!

Learning your way around., Powershell

Formatting dates from text or objects

Ever imported data just to have a non readable date stamp?

Get-date can take your text that is a date and turn it into something more readable.

Take “15-FEB-20” for example. It’s not really a wildly used format.

Pipe that to get-date like so:

Then you can format your date to remove time and what not.

If you have imported the data you can fix the entry using the select statement.

$data |select name,@{name=’Birthday’;e={$_.birthday | get-date -format MM-dd-yyyy}}