Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Find-OfficeExcel

Module
PSWriteOffice
Inputs
OfficeIMO.Excel.ExcelDocument System.String[]

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: Document
Find-OfficeExcel
[-CaseSensitive]
[-Exact]
[-Path] <String[]>
[-Pattern] <String>
[-Range <String>]
[-Sheet <OfficeSheetSelector[]>]
[-SimpleMatch]
[<CommonParameters>]
#
Parameter set: Path
Find-OfficeExcel
[-CaseSensitive]
[-Exact]
-LiteralPath <String[]>
[-Pattern] <String>
[-Range <String>]
[-Sheet <OfficeSheetSelector[]>]
[-SimpleMatch]
[<CommonParameters>]
#
Parameter set: LiteralPath

Examples

Find cells containing a value

Find-OfficeExcel -Path .\Reports\Inventory.xlsx -Pattern 'WEB01' -SimpleMatch

Lists 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 optional
Matches names and text using ordinal case sensitivity. Omission ignores case.
-Document ExcelDocument optionalpipeline: True (ByValue)sets: Document
Caller-owned workbook; omission uses the enclosing Excel content block.
-Exact SwitchParameter optional
Require an exact cell text match instead of substring matching.
-Pattern String requiredposition: 1
Date or DateTime number format pattern.
-Range String optional
A1 cell range on the selected worksheet.
-Sheet OfficeSheetSelector[] optionalaliases: WorksheetName
Worksheet name, one-based position or native worksheet object. Multi-sheet commands also accept wildcard names.
-SimpleMatch SwitchParameter optional
Uses literal text matching instead of regular expressions.
-Path String[] requiredposition: 0pipeline: True (ByValue)aliases: FilePathsets: Path
Workbook paths resolved with filesystem wildcard support.
-LiteralPath String[] requiredpipeline: True (ByPropertyName)aliases: FullName, PSPathsets: LiteralPath
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.