---
title: "is_encrypted_xlsx"
---

[< Back to Reference](../reference.qmd) | [View source](https://codeberg.org/usrbinr/tidychain/src/branch/main/R/read_calc_chain.R#L134)

# `is_encrypted_xlsx()`

Check if an xlsx file is encrypted

## Usage

```r
is_encrypted_xlsx(path)
```

## Arguments

| Argument | Description |
|----------|-------------|
| `path` | Path to an .xlsx file. |

## Value

Logical. TRUE if file is encrypted, FALSE otherwise.

## Description

Detects if an Excel file is encrypted (protected with "Encrypt with Password").
Encrypted files use OLE compound document format instead of ZIP.

## Details

Encrypted Excel files have the OLE signature (D0 CF 11 E0...) at the start
instead of the ZIP signature (50 4B 03 04). This function checks the file
header to detect encryption.

Note: This detects FILE encryption, not sheet protection. Sheet protection
can be removed without the password using `remove_sheet_protection()`.

## Examples

```r
## Not run: 
is_encrypted_xlsx("normal_file.xlsx")
#> [1] FALSE

is_encrypted_xlsx("encrypted_file.xlsx")
#> [1] TRUE

## End(Not run)
```

