Cmdlet
Find-OfficeExcel
Finds cells whose values match a pattern in a workbook, sheet or range.
Syntax
Find-OfficeExcel
[-CaseSensitive]
[-Document <ExcelDocument>]
[-Exact]
[-Pattern] <String>
[-Range <String>]
[-Sheet <OfficeSheetSelector[]>]
[-SimpleMatch]
[<CommonParameters>]#Parameter set:
DocumentFind-OfficeExcel
[-CaseSensitive]
[-Exact]
[-Path] <String[]>
[-Pattern] <String>
[-Range <String>]
[-Sheet <OfficeSheetSelector[]>]
[-SimpleMatch]
[<CommonParameters>]#Parameter set:
PathFind-OfficeExcel
[-CaseSensitive]
[-Exact]
-LiteralPath <String[]>
[-Pattern] <String>
[-Range <String>]
[-Sheet <OfficeSheetSelector[]>]
[-SimpleMatch]
[<CommonParameters>]#Parameter set:
LiteralPathExamples
Find cells containing a value
Find-OfficeExcel -Path .\Reports\Inventory.xlsx -Pattern 'WEB01' -SimpleMatchLists every cell in the workbook that mentions the server WEB01.
Find retired certificates that are still listed
$old = Import-OfficeCsv -Path .\Security\Retired-Certificates.csv
foreach ($certificate in $old) {
Find-OfficeExcel -Path .\Security\Certificates.xlsx -Sheet Inventory -Pattern $certificate.Thumbprint -SimpleMatch -Exact
}Looks up each retired certificate thumbprint on the inventory sheet and shows where it still appears.
Parameters
- -CaseSensitive SwitchParameter
- Matches names and text using ordinal case sensitivity. Omission ignores case.
- -Document ExcelDocument
- Caller-owned workbook; omission uses the enclosing Excel content block.
- -Exact SwitchParameter
- Require an exact cell text match instead of substring matching.
- -Pattern String
- Date or DateTime number format pattern.
- -Range String
- A1 cell range on the selected worksheet.
- -Sheet OfficeSheetSelector[]
- Worksheet name, one-based position or native worksheet object. Multi-sheet commands also accept wildcard names.
- -SimpleMatch SwitchParameter
- Uses literal text matching instead of regular expressions.
- -Path String[]
- Workbook paths resolved with filesystem wildcard support.
- -LiteralPath String[]
- Literal workbook paths, including FileInfo.FullName and provider PSPath.
Common Parameters
This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
For more information, see about_CommonParameters.