You can use ImportExcel module.
Since i do not have your XLSX file I need to create one to visualise the example:
# using temp directory to create file
Set-Location $env:TEMP
$excelFiles = "ImportExcelHowTo.xlsx"
# remove any pre-existing file
Remove-Item $excelFiles -ErrorAction SilentlyContinue
# create a file with some data
$data = ConvertFrom-Csv -InputObject @"
Phone,Dept
111-111-1111,James Mary
222-222-2222,Patricia John
333-333-3333,Jennifer Robert
444-444-5555,Michael Linda
555-555-5555,Elizabeth William
"@
# export data to XLSX file
$data | Export-Excel $excelFiles
# open the file if you need
# Invoke-Item $excelFiles
Now I can read the Excel file using Import-Excel function
$data2 = Import-Excel -Path $excelFiles -WorksheetName Sheet1
It will look like that:
Phone Dept
----- ----
111-111-1111 James Mary
222-222-2222 Patricia John
333-333-3333 Jennifer Robert
444-444-5555 Michael Linda
555-555-5555 Elizabeth William
More examples on my blog or ImportExcel GitHub repo.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…