$xl = New-Object -Com "Excel.Application"
$xl.Visible = $true
$wb = $xl.Workbooks.Open("C:UsersVIKRAMDocumentsBook1.xlsx")
$ws = $wb.Sheets.Item(1)
#Looking up a value in one column and assigning the corresponding value from another column to a variable could be done like this:
for ($i = 1; $i -le 10; $i++) {
if ($ws.Cells.Item($i, 2).value2 -eq "FALSE"){
#$get=$ws.Cells.Item($i, 1).Value
Write-Host $ws.Cells.Item($i,1).Value2|Out-File "C:UsersVIKRAMDocumentsBook2.txt"
}
}$wb.Close()
$xl.Quit()
excel -Book1
ffff | FALSE |
hhhh'bbb | FALSE |
vffd | TRUE |
jghj | FALSE |
jhhj | FALSE |
nbgh | FALSE |
nbj | FALSE |
cxb | TRUE |
Initially I could receive output but it got stopped and now nothing was retrieved – No error as well.
I should get value in col1 if the column2 has FALSE.
Any help would be highly appreciated..
Thanks in advance