Keep your spreadsheet and app in lockstep
3 min
Edit on either side, push the diff back. The Database → Sync tab does both directions.
Spreadsheet-scaffolded apps record their source workbook in `<projectPath>/.nxr/spreadsheet-source.json`. The Database tab's Sync sub-tab is the single surface for keeping the two in lockstep:
• Pull (file → app) Click 'Pull from workbook' in the Sync tab. Avery reads the .xlsx, computes the diff against the app's current Prisma data, and renders a `<SpreadsheetDiffViewer>` showing every cell that changed (added rows, deleted rows, modified cells). You pick a conflict policy (overwrite app / keep app / per-row prompt) and apply.
• Push (app → file) Click 'Push to workbook' in the Sync tab. Avery serialises every Prisma row back into the .xlsx via exceljs, preserving formatting + formulas + charts that aren't tied to the affected ranges. The file is written in place; you can re-open it in Excel and see the changes.
• Drift detection The Sync tab auto-runs `/scaffold.spreadsheet.diff` on mount + watches the file via `/scaffold.spreadsheet.watch.start`. When the workbook changes on disk (someone edited it in Excel), you get a banner with a one-click 'Pull' affordance.
When does bidirectional sync break down?
• Schema changes — if you add a NEW column to the .xlsx, that's a schema change, not a data change. Re-scaffold OR add a Prisma migration manually. • Formulas — formula CELLS sync; the formula itself stays in the .xlsx. The app reads through `lib/xl/<sheet>.ts` so derived columns are computed on demand. • External references (workbooks linking to other workbooks) — only the local workbook is the source of truth. Cross-workbook links are skipped.
This is the killer feature for teams whose finance / ops people live in Excel: you give them a real app for the rest of the team while letting Excel stay the system of record. Every weekly accounting update is a file edit; every customer support change is an app edit; both flow.
Live recipes need the desktop
This article is a static preview. The in-app Help sidecar inside Avery NXR can fire each step against your live project — install the desktop to use it interactively.