Param($FilePath,$SheetName,$CellAddr) if ($PSBoundParameters.Count -ne 3) { Write-host "Error: -FilePath -SheetName -CellAddr " ;exit 1 } If ( -not (Test-Path $FilePath)) { Write-host "Error: -FilePath does not exist." ;exit 1 } $excel = New-Object -ComObject Excel.Application $workbook = $excel.workbooks.Open($filepath) foreach ($sheet in $workbook.Sheets) { if ($sheet.Name -eq $sheetname) { $range = $sheet.Range($celladdr) $range.Value() } } $workbook.Quit $excel.Quit()