title: Finding content of Excel file in Powershell
body: <p>I am currently working on a fairly large powershell script. However, I got stuck at one part. The issue is the following.</p>
  
  <p>I have various reports with the same file name, they just have a different time stamp at the end. Within the report, I have a field displaying the date from when to when the report is from.</p>
  
  <p>---> 2/1/2015   5:00:00AM to 3/1/2015   5:00:00AM &lt;--- This is what it looks like.</p>
  
  <p>This field is randomly placed on the Excel Sheet. Pretty much in the range of A5 to Z16. What I would like the script to do is:</p>
  
  <p><strong>Read the file</strong> <strong>/</strong> <em>Check the range of cells for the dates, if the date is found and it matches my search criteria, close the sheet and move it to a different folder</em> <strong>/</strong> <strong>If date does not match, close and check next XLS file</strong></p>
  
  <p>This is what I got so far:</p>
  
  <pre><code>$File = "C:\test.XLS" 
  $SheetName = "Sheet1"
  # Setup Excel, open $File and set the the first worksheet
  $Excel = New-Object -ComObject Excel.Application
  $Excel.visible = $true
  $Workbook = $Excel.workbooks.open($file)
  $Worksheets = $Workbooks.worksheets
  $WorkSheet = $WorkBook.sheets.item($SheetName)
  $SearchString = "AM" #just for test purposes since it is in every report
  $Range = $Worksheet.Range("A1:Z1").EntireColumn
  $Search = $Range.find($SearchString)
  </code></pre>