Excel Sheet Filter (PowerShell Script)
Easily extract rows from Excel based on any column and value — fully automated and beginner-friendly.
What It Does
-
Reads an Excel
.xlsx
file -
Filters rows where a specified column equals a given value (e.g.
Status = Completed
) -
Exports the filtered results into a new Excel file
-
No need for Excel software – works directly via PowerShell
-
Useful for data cleanup, reporting, and automation
How to Use
-
Open the script in any text editor (e.g., Notepad)
-
Edit the following lines at the top of the script:
-
$inputFile
= path to your original Excel file -
$outputFile
= where the filtered result will be saved -
$filterColumn
= name of the column to filter -
$filterValue
= the value you want to filter for
-
-
Save and run the script with PowerShell
A sample Excel file is included so you can try it out right away.
Example
Extract rows where:Status = Completed
Requirements
-
Windows PowerShell
-
Internet connection (for first-time auto-install of the ImportExcel module)
If You See a Security Error
If Windows blocks the script, run this command to unblock the file:
Or run the script using:
To permanently allow local scripts for your user account:
What’s Included
-
ExcelFilter.ps1
– the script file -
README.txt
– setup and usage instructions -
sample_excel_filter.xlsx
– sample file for testing