title: Powershell - Filter an Excel File
body: <p>I would like to add a filter for an Excel file within a PowerShell script.</p>
  <p>So &quot;if you find in column D the entry &quot;Listener&quot;, make the whole row invisible, so filter it out, so that only rows are shown where no &quot;Listener&quot; occurs.</p>
  <p>Can I implement this with PowerShell somehow? I tried but it didn't work.</p>
  <p>i tried it with this :</p>
  <pre><code>$column = 4 # column D
  $filename = &quot;C:\Users\xxxxx\Desktop\Test.XLS&quot;
  $criteria = &quot;Listener&quot;
  $Excel = New-Object -ComObject Excel.Application
  $Excel.Visible = $true
  $workbook = $Excel.Workbooks.Open($filename)
  $worksheet = $workbook.Worksheets.Item(1)
  $usedrange = $worksheet.UsedRange
  $usedrange.EntireColumn.AutoFilter()
  $usedrange.AutoFilter($column, $criteria)
  $worksheet.UsedRange.offset($column,4).EntireLine.Delete()
  </code></pre>
  <p>Thanks!</p>