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 :
we can pipe this into an “install-module” command with a few parameters to ensure a smooth install.
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!