# Find-OfficeExcel

Finds cells whose values match a pattern in a workbook, sheet or range.

Cmdlet 

**Module**

`PSWriteOffice`

**Inputs**

`OfficeIMO.Excel.ExcelDocument` `System.String[]`

**Source**

[FindOfficeExcelCommand.cs:29](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/PowerShell/PSWriteOffice/Sources/PSWriteOffice/Cmdlets/Excel/FindOfficeExcelCommand.cs#L29) 

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>]
```

[#](#method-find-officeexcel-switchparameter-exceldocument-switchparameter-string-string-officesheetselector-switchparameter)

Parameter set: `Document`

```
Find-OfficeExcel
[-CaseSensitive]
[-Exact]
[-Path] <String[]>
[-Pattern] <String>
[-Range <String>]
[-Sheet <OfficeSheetSelector[]>]
[-SimpleMatch]
[<CommonParameters>]
```

[#](#method-find-officeexcel-switchparameter-switchparameter-string-string-string-officesheetselector-switchparameter)

Parameter set: `Path`

```
Find-OfficeExcel
[-CaseSensitive]
[-Exact]
-LiteralPath <String[]>
[-Pattern] <String>
[-Range <String>]
[-Sheet <OfficeSheetSelector[]>]
[-SimpleMatch]
[<CommonParameters>]
```

[#](#method-find-officeexcel-switchparameter-switchparameter-string-string-string-officesheetselector-switchparameter-2)

Parameter set: `LiteralPath`

## Examples

### Find cells containing a value

```powershell
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

```powershell
$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](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters).

<!-- PowerForge markdown artifact sha256:6BB0E68D1A9E39029BAEA75C8C9E33A9BF504A365D243A13492B7F91DC1C02D3 -->
