'How to filter excel file using three or more criteria and copy the filtered data to another sheet using powershell
I have a excel table as below: excel data
I want to filter this file based on three criteria i.e. $criteria = "Rice","Vegetables","Butter"
and copy the filtered data to another excel file. How can I filter using three criteria using AdvancedFilter from powershell, a part of the code I have is like below, however it is not working:
$criteria = "Rice","Vegetables","Butter"
$srange = $swb.UsedRange
$xlFilterInPlace = [Microsoft.Office.Interop.Excel.XlFilterAction]::xlFilterInPlace
$missing = [Type]::Missing
$srange.AdvancedFilter($xlFilterInPlace,$Criteria, $missing, $missing, $TRUE)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|