{"id":6425,"date":"2021-11-19T07:39:37","date_gmt":"2021-11-19T07:39:37","guid":{"rendered":"https:\/\/lgildv5i97.onrocket.site\/answers\/?post_type=question&#038;p=6425"},"modified":"2021-11-19T07:42:43","modified_gmt":"2021-11-19T07:42:43","slug":"find-an-entry-in-excel-file-powershell","status":"publish","type":"question","link":"https:\/\/computing.net\/answers\/programming\/find-an-entry-in-excel-file-powershell\/29702.html","title":{"rendered":"Find An Entry In Excel File Powershell"},"content":{"rendered":"<p>I have a text document with servers listed as<br \/>\nserver01<br \/>\nserver02<br \/>\n.<br \/>\n.<br \/>\n.<br \/>\nI have an excel document with a list of servers<br \/>\nI would like to take the text document line E.G. server01<br \/>\nand look for it in the excel document..<\/p>\n<p>Here is the logic I have for taking server01 from text document and searching in excel<\/p>\n<p>foreach ($server in $manlist){<\/p>\n<p>while (($ExcelWorkSheet.Cells.Item($Row, $Column).Value() -ne $Null)) {<\/p>\n<p>If (($ExcelWorkSheet.Cells.Item($Row, $Column).Value()).ToUpper() -eq $server.ToUpper()) {<br \/>\n#^&#8211; Cell value equals $Arg<br \/>\nWrite-Host ($ExcelWorkSheet.Cells.Item($Row, $Column).value())<br \/>\n$Row++<\/p>\n<p>}<br \/>\nelse{<br \/>\n$Row++<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>It finds the first match and then no others&#8230; There are others and i know my logic is confusing it somewhere. Can anyone help<\/p>\n<p>im using powershell for this<\/p>\n<p>$manlist is the text document<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"iawp_total_views":9},"question-category":[55],"question_tags":[],"class_list":["post-6425","question","type-question","status-publish","hentry","question-category-programming"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question\/6425","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question"}],"about":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/types\/question"}],"author":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/comments?post=6425"}],"wp:attachment":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/media?parent=6425"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question-category?post=6425"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question_tags?post=6425"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}