$xlsFilePath = "C:\Excel_file.xlsx" $xl = New-Object -comobject Excel.Application $xl.Visible = $False $xl.DisplayAlerts = $False $wb = $xl.WorkBooks.Open($xlsFilePath) $ws = $wb.Worksheets.Item(1) $value = $ws.Cells.Item(1, "A").Value2 Write-Host $value # ... $wb.Close($false) $xl.Quit() [System.GC]::Collect() [System.GC]::WaitForPendingFinalizers() [System.Runtime.Interopservices.Marshal]::ReleaseComObject($xl) | Out-Null
Parsing Excel document using PowerShell
Bookmark the permalink.