---
title: "read_xlsx_structure"
---

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

# `read_xlsx_structure()`

Read Excel Sheet Structure

## Usage

```r
read_xlsx_structure(path, sheets = NULL)
```

## Arguments

| Argument | Description |
|----------|-------------|
| `path` | Path to an .xlsx file. |
| `sheets` | Character vector of sheet names to read. If NULL (default), reads all sheets. |

## Value

A tibble containing:

- `sheet_name`: Name of the sheet

- `cell_ref`: Cell reference (e.g., "A1", "B5")

- `row`: Row number

- `col`: Column letter

- `col_num`: Column as numeric index

- `has_formula`: TRUE if cell contains a formula

- `formula`: The formula (if any), NA otherwise

- `value`: Cell value (as character)

## Description

Reads the actual structure of Excel worksheets, including which cells
contain formulas and their current row positions. This information is
used alongside `read_calc_chain()` to detect anomalies where the
calculation chain order differs from the current row order.

## Examples

```r
## Not run: 
structure <- read_xlsx_structure("spreadsheet.xlsx")
# Filter to just formula cells
formulas <- dplyr::filter(structure, has_formula)

## End(Not run)
```

