# garcias/sheets-functions architecture

> Architecture diagram of the GitHub repository garcias/sheets-functions, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/garcias/sheets-functions
- Repository: https://github.com/garcias/sheets-functions

## Overview

This repository is a collection of Google Sheets named-function definitions, not a JavaScript application. A user copies or imports a definition into a spreadsheet, supplies ranges or values, and Sheets evaluates the formula to produce an array or scalar result. The central capabilities include joins, reshaping and lookup, plus text, scheduling and regression helpers. The README documents several formulas whose implementations are not visible in the excerpts; those are included as capabilities, without inferred internal dependencies.

Main entry points: [`functions.js`](https://github.com/garcias/sheets-functions/blob/main/functions.js) (Table joins), [`legacy.js`](https://github.com/garcias/sheets-functions/blob/main/legacy.js) (Legacy formulas)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_user(("Spreadsheet user"))
node_sheet["Google Sheets"]
node_join["Table joins<br/>[functions.js]"]
node_reshape["Data reshaping<br/>[functions.js]"]
node_lookup["Lookup helpers<br/>[functions.js]"]
node_template["Template substitution<br/>[functions.js]"]
node_roundrobin["Round robin<br/>[functions.js]"]
node_regression["Labeled regression<br/>[functions.js]"]
node_legacy["Legacy formulas<br/>[legacy.js]"]
node_result["Formula result"]

node_user -->|"uses"| node_sheet
node_sheet -->|"evaluates"| node_join
node_sheet -->|"evaluates"| node_reshape
node_sheet -->|"evaluates"| node_lookup
node_sheet -->|"evaluates"| node_template
node_sheet -->|"evaluates"| node_roundrobin
node_sheet -.->|"evaluates"| node_regression
node_join -->|"returns array"| node_result
node_reshape -->|"returns array"| node_result
node_lookup -->|"returns value"| node_result
node_template -->|"returns text"| node_result
node_roundrobin -->|"returns pairings"| node_result
node_regression -.->|"returns labels"| node_result
node_sheet -->|"evaluates"| node_legacy
node_legacy -->|"returns array"| node_result
node_join -->|"trims headers"| node_reshape

click node_join "https://github.com/garcias/sheets-functions/blob/main/functions.js"
click node_reshape "https://github.com/garcias/sheets-functions/blob/main/functions.js"
click node_lookup "https://github.com/garcias/sheets-functions/blob/main/functions.js"
click node_template "https://github.com/garcias/sheets-functions/blob/main/functions.js"
click node_roundrobin "https://github.com/garcias/sheets-functions/blob/main/functions.js"
click node_regression "https://github.com/garcias/sheets-functions/blob/main/functions.js"
click node_legacy "https://github.com/garcias/sheets-functions/blob/main/legacy.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_user toneBlue
class node_sheet,node_result toneIndigo
class node_join,node_lookup,node_template,node_roundrobin,node_regression,node_legacy toneTeal
class node_reshape toneMint
```

## Components

### Other components

- **Spreadsheet user**
- **Google Sheets**
- [Table joins](https://github.com/garcias/sheets-functions/blob/main/functions.js): `functions.js`
- [Data reshaping](https://github.com/garcias/sheets-functions/blob/main/functions.js): `functions.js`
- [Lookup helpers](https://github.com/garcias/sheets-functions/blob/main/functions.js): `functions.js`
- [Template substitution](https://github.com/garcias/sheets-functions/blob/main/functions.js): `functions.js`
- [Round robin](https://github.com/garcias/sheets-functions/blob/main/functions.js): `functions.js`
- [Labeled regression](https://github.com/garcias/sheets-functions/blob/main/functions.js): `functions.js`
- [Legacy formulas](https://github.com/garcias/sheets-functions/blob/main/legacy.js): `legacy.js`
- **Formula result**

## Connections

- Spreadsheet user → Google Sheets: uses (evidence: `README.md`)
- Google Sheets → Table joins: evaluates (evidence: `functions.js`)
- Google Sheets → Data reshaping: evaluates (evidence: `functions.js`)
- Google Sheets → Lookup helpers: evaluates (evidence: `functions.js`)
- Google Sheets → Template substitution: evaluates (evidence: `functions.js`)
- Google Sheets → Round robin: evaluates (evidence: `functions.js`)
- Google Sheets → Labeled regression: evaluates (evidence: `README.md`)
- Table joins → Formula result: returns array (evidence: `functions.js`)
- Data reshaping → Formula result: returns array (evidence: `functions.js`)
- Lookup helpers → Formula result: returns value (evidence: `functions.js`)
- Template substitution → Formula result: returns text (evidence: `functions.js`)
- Round robin → Formula result: returns pairings (evidence: `functions.js`)
- Labeled regression → Formula result: returns labels (evidence: `README.md`)
- Google Sheets → Legacy formulas: evaluates (evidence: `legacy.js`)
- Legacy formulas → Formula result: returns array (evidence: `legacy.js`)
- Table joins → Data reshaping: trims headers (evidence: `functions.js`)
