Sheetwrite 0.7.0: dashboards, a data model with measures, in-place sort, linked workbooks, saved queries, version history and Excel's editing tools, and what to change when you upgrade.
Update each adapter and add-on you use to 0.7.0 too: all packages release together.
Sheetwrite 0.7.0 turns a workbook into an analysis tool. Tables relate to each other in a data
model, measures calculate over it, and dashboards put pivots, slicers, PivotCharts and KPI cards
on one sheet. Sort moves the cells, as Excel's Sort does. Formulas read other workbooks, saved
queries refresh tables from your sources, and version history saves, compares and restores
versions. Editing works as in Excel: AutoFilter, cut and paste that moves cells, Paste Special,
Data Validation, Format Cells, Excel's keys with a panel to change them, and AutoComplete. Formula
assist suggests the rest of a formula in the formula bar. Every add-on now installs through one
call. Read the breaking changes before you upgrade.
A dashboard over the data model: KPI cards, a region slicer, a PivotChart and a pivot with a share-of-total measure.A dashboard over the data model, filtered by the Region slicer: KPI cards beside a PivotChart of revenue by month.A dashboard over the data model, filtered by the Region slicer: KPI cards above a PivotChart of revenue by month.
Workbook tables relate one-to-many by stable table and column IDs, with undoable, synced
setRelationship and removeRelationship operations.
SheetwriteStore.getRelationshipStatus(id) reports unmatched keys, duplicate lookup keys,
type mismatches and removed columns.
Pivot tables use fields from related tables with the { model: { table, fields } } source.
The pivot field list shows the columns of related tables, and adding one turns a table pivot
into a model pivot in one undo step.
Data › Data Tools has Data Model, Relationships and Measures panels.
Measures
Measures are formulas over model columns, calculated in the filter context of each pivot cell,
with a { measure } value field and setMeasure / removeMeasure operations.
Measures read related tables, refer to other measures by [Name], follow renames, and
GETPIVOTDATA reads them by name.
CALCULATE(expression, filter, …) with column comparisons and ALL(Table[Column]) changes
the filter context.
Dashboards
Dashboard sheets (kind: "dashboard") hold pivot, slicer, chart and KPI items on a 12-column
grid. Items move and resize with the mouse and the keyboard, and Insert › New Dashboard adds
one.
Slicers filter every pivot whose table reaches the slicer column through relationships, and
dim or hide values that no row has under the other slicers.
PivotCharts and KPI cards: a chart item charts a pivot, and a KPI card shows one measure in
the slicers' filter context.
XLSX export writes each dashboard as a worksheet of its current values, with PivotCharts as
native charts, and the dashboard opens as a dashboard again.
Charts
Charts over a pivot plot its leaf items, as Excel PivotCharts do, and can plot only some of
its values, measures included.
Multi-level category labels, as Excel draws them, kept in XLSX as c:multiLvlStrRef.
XLSX import and export read and write Excel column, bar, line, area, pie, doughnut and scatter
charts.
XLSX export marks spilling formulas as dynamic arrays, so Excel spills them instead of showing
=@SEQUENCE(3), and a text column round-trips in Excel's Text format @.
Data
Sort in place
store.sortRange and grid.sortRange sort the cells, as Excel does: one undoable, synced
change with the permuteRows operation and the "sort" commit reason. Formulas, merged
cells, spill ranges and tables follow Excel's rules.
Sort A to Z and Sort Z to A sort in place from the ribbon, the toolbar and the column menu.
Data › Custom Sort (Excel's Data › Sort) opens a Sort panel with sort levels, a header row and a "Sort view only"
option.
Sorts use Excel's sort order: case-insensitive text in Excel's character order, errors after
logical values, and blanks last in both directions.
Linked workbooks
Formulas accept references to other workbooks, such as [Budget.xlsx]Annual!C10, and to
their defined names, such as Budget.xlsx!Total. They show the values the link saved, or
#REF! without them.
XLSX import keeps external links and the values Excel saved, and export writes them back.
externalLinksAddon({ resolve }) updates links from your resolver, points them at another
workbook or breaks them into values, as one undoable change. Data › Queries & Connections ›
Edit Links runs the same commands.
Saved queries
The optional @sheetwrite/queries package is a columnar query engine for CSV, JSON and typed
host batches, in a lazily loaded WebAssembly module of 85 KiB gzipped.
Saved workbook queries refresh into workbook tables through queriesAddon({ fetchSource }):
one undoable, synced transaction per refresh, with sources loaded only through your callback.
Data › Get Data, Refresh All and Queries & Connections in the ribbon and toolbar. XLSX keeps
saved queries as Power Query M.
Version history
historyAddon() adds Review › Version History and Save Version: save named versions, compare
a version with the current document, preview it read-only, and restore the workbook, a sheet
or a range.
HistoryArchive stores versions in content-addressed chunks through a
HistoryStorageAdapter or the built-in IndexedDB adapter. diffVersions pages changed cells
with their authors. A 17 KB gzip WebAssembly kernel computes the comparison and loads only
when one opens.
SyncCoordinatorOptions.authorId records who made each change.
Formulas
Defined-name formulas, named LAMBDAs and a Name Manager.
Formula help in the cell editor and the formula bar: Formula AutoComplete, an argument guide,
live syntax errors, reference colours and Formulas › Explain Formula, a Sheetwrite command that Excel doesn't have. Alt+Enter adds a line
break, and both editors grow to eight lines.
Formula assist, the new @sheetwrite/formula-assist package installed with
initSheetwrite({ addons: [formulaAssistAddon()] }), shows the likely rest of a formula as
ghost text in the formula bar. It learns from the neighbouring cells, the column's pattern and
the formulas of the workbook's visible sheets, in memory only. It shows a suggestion only when
the benchmark measured it right at least 90% of the time, and 98% for suggestions from the rest
of the workbook. Tab takes it, Ctrl+→ (⌥→ on macOS) takes one word, Esc hides it, the
suggestion stays while you type it, and the ranges it names get a faint fill. On a held-out set
of real workbooks it saves 62.2% of keystrokes, with 0.7% of suggestions wrong. See
Formula assist.
Custom JavaScript functions with metadata install with functionsAddon([...]) and appear in
Formulas › Insert Function.
The full engine adds Excel's engineering, complex number, Bessel, CONVERT, remaining
financial, Excel 2007 statistics, byte-width text and GETPIVOTDATA functions. Both engines
add 30 math functions, LOOKUP, TRIMRANGE, the A statistics and the information
functions. See Excel function coverage.
Grid and editing
The toolbar, the full ribbon and a new compact ribbon (config.ribbon: { mode: "compact" })
render one command model.
File › Import XLSX opens a workbook in the current grid, and grid.importWorkbook replaces
the document without recreating the grid.
grid.trimMemory() gives back memory an open grid can build again.
Moving rows or columns moves the cells, as Excel's Insert Cut Cells does, and every reference
follows them.
grid.sheetRowOf and grid.viewRowOf map between displayed rows and data rows, and the
edit-begin, edit-commit and selection events carry the cell's data-row address too.
Excel editing
Filter, cut and paste
AutoFilter: Data › Filter or Ctrl+Shift+L puts filter buttons on a header row. A button, or
Alt+Down on a header cell, opens Excel's dropdown: sort, Number, Text and Date Filters with
custom conditions, and a searchable value list with row counts. Date columns group by year,
month and day. Each change is one undo step that syncs, and XLSX keeps the filter.
Cut and paste moves cells: cut marks the cells with a moving border, and the paste moves
their values, formulas, formats, notes, links, merged cells and rules. Every formula, name and
chart that refers to them follows, as one undo step and one moveCells operation.
Paste Special: Ctrl+Alt+V, Home › Paste and the context menu open Excel's dialog, with every
Paste choice, Add, Subtract, Multiply, Divide, Skip blanks, Transpose and Paste Link. Paste
Options paste Values, Formulas, Formatting, Transpose or Paste Link in one click.
Fill: the fill handle continues Excel's series, shows each new value while it drags, and
offers Auto Fill Options after the fill.
Paste over hidden rows: a pasted block over a filtered range or hidden rows writes into
every sheet row, the hidden rows included, as in Excel, and says how many hidden rows it wrote.
Paste Options › Paste into visible rows only (grid.actions.pasteVisibleRows()) pastes on the
shown rows instead.
Insert and Delete shift cells right, down, left or up, as in Excel.
Delete and grid.actions.clearContents() clear values and keep the cells' formats, as
Excel's Delete does.
Validation and formats
Data Validation: Data › Data Validation opens Excel's dialog with Settings, Input Message
and Error Alert. Rules take every Excel type, lists from a range or a defined name, and formula
bounds. A list cell shows a dropdown arrow, typing filters its list, and a rejected value shows
Excel's Stop, Warning or Information alert.
Format Cells: Ctrl+1 opens a dialog with Number, Alignment, Font, Border and Fill, and the
selected cells preview the new format until OK or Cancel. Fraction, Text and elapsed-time
formats work as in Excel.
General: new sheets, addSheet without columns, XLSX imports and adapter columns without
type use the new general column type, which reads typing as Excel does. A number with no
format shows as Excel's General: 2026, not 2,026, and 1.23457E+11 for a long number.
Keys and typing
Excel's keys: the active cell, Enter and Tab, the editor's Enter, Edit and Point modes, and
Excel's format, fill, hide, insert and sheet keys.
Keyboard shortcuts dialog: config.keyboardSettings: true adds a dialog where users search
commands by name or keys, record, swap and reset keys, and export them. The grid emits
key-bindings-change for you to store.
AutoComplete: typing a text entry completes it from the column, and several matches show
in a list. Alt+Down opens Excel's Pick From Drop-down List.
Find: Excel's wildcards and Find Options, Find All and workbook search. Find matches a
number by the text the cell shows ($4.50, 15%), selects each match, and previews what
Replace all will change.
Formula editor: the formula list offers names, tables, columns and argument values; a
formula that doesn't parse is refused with Excel's message; live errors offer a one-click fix.
Performance
On the release commit, recalculation takes about a third of 0.6.1's time: 2.8× faster on Linux
and 3.1× on the Mac. XLSX import takes 0.64–0.65 of 0.6.1's time on both machines, and 100,000
loaded formulas hold 24–39% less memory on Linux. The engine download is 28% (default) and 32%
(full) larger. Large INDEX/MATCH lookups are up to 125 times faster than before the change
that sped them up.
0.7.0 against 0.6.1
Every figure in this section compares 0.7.0 with 0.6.1 on the same machine: Linux is an
i9-12900H, Mac an M5 Pro.
Release comparison
The release capture ran on the release commit, with the published 0.6.1 packages beside it on
both machines. Of 1,133 rows measured on both versions, 691 are at least 5% faster or smaller,
403 are within 5%, and 34 are slower beyond their noise, each with a stated reason below.
0.7.0 against 0.6.1, by user action
LinuxIntel Core i9-12900H
MacApple M5 Pro
Speed against 0.6.1 on the same machine, log scale: right of 1× is faster, left of 1× is slower. "0.5 of the time" plots at 2× faster.
1×4×16×
First load and startupLinux 0.93 of the time
Opening a workbook or XLSX fileOpening a workbook or XLSX fileLinux: 0.54 of the time; Mac: 0.66 of the timeLinux 0.54 of the timeMac 0.66 of the time
ExportExportLinux: 0.81 of the time; Mac: 0.77 of the timeLinux 0.81 of the timeMac 0.77 of the time
ScrollingScrollingLinux: 0.33 of the time; Mac: 0.44 of the timeLinux 0.33 of the timeMac 0.44 of the time
Selecting and editingSelecting and editingLinux: 0.57 of the time; Mac: 0.83 of the timeLinux 0.57 of the timeMac 0.83 of the time
Typing formulas and recalculationTyping formulas and recalculationLinux: 0.22 of the time; Mac: 0.39 of the timeLinux 0.22 of the timeMac 0.39 of the time
Filters, sorts and pivotsFilters, sorts and pivotsLinux: 0.49 of the time; Mac: 0.11 of the timeLinux 0.49 of the timeMac 0.11 of the time
ChartsChartsLinux: 0.24 of the timeLinux 0.24 of the time
Collaboration and historyCollaboration and historyLinux: 0.32 of the timeLinux 0.32 of the time
Memory over a long sessionMemory over a long sessionLinux: 0.80 of the time; Mac: 0.73 of the timeLinux 0.80 of the timeMac 0.73 of the time
Each mark is the geometric mean of the 0.7.0 / 0.6.1 ratios of that action's rows.
Version comparison, 0.7.0 against 0.6.1
LinuxIntel Core i9-12900H
MacApple M5 Pro
Speed against 0.6.1 on the same machine, log scale: right of 1× is faster, left of 1× is slower. "0.5 of the time" plots at 2× faster.
1×2×4×8×
Recalculation, geomean of the shared rows, default engineRecalculation, geomean of the shared rows, default engineLinux: 0.099 ms instead of 0.273 ms; Mac: 0.029 ms instead of 0.089 msLinux 0.099 ms instead of 0.273 msMac 0.029 ms instead of 0.089 ms
Recalculation, geomean of the shared rows, full engineRecalculation, geomean of the shared rows, full engineLinux: 0.101 ms instead of 0.278 ms; Mac: 0.029 ms instead of 0.089 msLinux 0.101 ms instead of 0.278 msMac 0.029 ms instead of 0.089 ms
Recalculate a fan-out over 100,000 formulasRecalculate a fan-out over 100,000 formulasLinux: 7.24 ms instead of 33.30 ms; Mac: 2.75 ms instead of 16.47 msLinux 7.24 ms instead of 33.30 msMac 2.75 ms instead of 16.47 ms
XLSX import, 50,000 rows, default engineXLSX import, 50,000 rows, default engineLinux: 2,272 ms instead of 3,488 ms; Mac: 736 ms instead of 1,149 msLinux 2,272 ms instead of 3,488 msMac 736 ms instead of 1,149 ms
XLSX export, default engineXLSX export, default engineLinux: 1,454 ms instead of 1,763 ms; Mac: 438 ms instead of 520 msLinux 1,454 ms instead of 1,763 msMac 438 ms instead of 520 ms
Retained memory after loading 100,000 formulas: 40.4 MiB instead of 53.4 MiB (default) and
34.5 MiB instead of 56.2 MiB (full) on Linux, and 38.0 MiB instead of 63.8 MiB (full) on the
Mac. The Mac's default-engine change, and its peak memory, are within its noise.
Engine download, Brotli: 389 KiB instead of 304 KiB (default) and 557 KiB instead of 423 KiB
(full).
Before the release, a speed pass took the workloads that were slower than in 0.6.1 back below it
where it could. Each change measured its own rows against 0.6.1 on Linux.
Speed pass, 0.7.0 against 0.6.1
LinuxIntel Core i9-12900H
RangeLowest to highest across machines and engines
Speed against 0.6.1 on the same machine, log scale: right of 1× is faster, left of 1× is slower. "0.5 of the time" plots at 2× faster.
1×10×100×1,000×
RANK over 4,000 formulasRANK over 4,000 formulasLinux: 0.005 of the timeLinux 0.005 of the time
INDIRECT over 100,000 formulasINDIRECT over 100,000 formulasRange: 0.305–0.309 of the timeRange 0.305–0.309 of the time
Load 100,000 formulas with sheet-qualified referencesLoad 100,000 formulas with sheet-qualified referencesRange: 0.373–0.395 of the timeRange 0.373–0.395 of the time
ROUND over 10,000 formulasROUND over 10,000 formulasRange: 0.669–0.748 of the timeRange 0.669–0.748 of the time
OFFSET over 100,000 formulasOFFSET over 100,000 formulasRange: 0.516–0.522 of the timeRange 0.516–0.522 of the time
Conditional-format window, 100,000 rowsConditional-format window, 100,000 rowsRange: 0.441–0.453 of the timeRange 0.441–0.453 of the time
Build a 100,000-row pivotBuild a 100,000-row pivotLinux: 0.680 of the timeLinux 0.680 of the time
Paste 1,000 rows × 10 columnsPaste 1,000 rows × 10 columnsLinux: 8.98 ms instead of 18.59 msLinux 8.98 ms instead of 18.59 ms
CSV import, 200,000 rows × 10 columnsCSV import, 200,000 rows × 10 columnsLinux: 333.9 ms instead of 440.3 msLinux 333.9 ms instead of 440.3 ms
Select a range, with a command-state handlerSelect a range, with a command-state handlerLinux: 3.20 ms instead of 10.86 msLinux 3.20 ms instead of 10.86 ms
Multi-key sort of 10,000 rowsMulti-key sort of 10,000 rowsLinux: 1.673 ms instead of 5.518 msLinux 1.673 ms instead of 5.518 ms
One filter over 1,000,000 rowsOne filter over 1,000,000 rowsLinux: 5.8 ms instead of 6.6 msLinux 5.8 ms instead of 6.6 ms
Filter 100,000 rows by a list of 50,000 valuesFilter 100,000 rows by a list of 50,000 valuesLinux: 30.3 ms instead of 85.1 msLinux 30.3 ms instead of 85.1 ms
Create a 1,000,000-row paged storeCreate a 1,000,000-row paged storeLinux: 0.877–0.914 of the timeLinux 0.877–0.914 of the time
Read a window of cellsRead a window of cellsLinux: 0.869–0.891 of the timeLinux 0.869–0.891 of the time
Scroll sidewaysScroll sidewaysLinux: 0.42 of the timeLinux 0.42 of the time
Scroll downScroll downLinux: 0.19–0.25 of the timeLinux 0.19–0.25 of the time
Refuse a hostile XLSX file, in a fresh processRefuse a hostile XLSX file, in a fresh processLinux: 0.829–0.837 of the timeLinux 0.829–0.837 of the time
Every row of the pivot benchmark is faster than in 0.6.1, and two filters take 0.70 of 0.6.1's
time.
After an XLSX import, 1.07 MB stays in memory, against 1.10 MB in 0.6.1.
XLSX export peaks at 0.90–0.94 of 0.6.1's memory.
The engine's JavaScript glue is 4.4 KB smaller than in 0.6.1.
Still slower than 0.6.1
The release capture finds these rows slower than 0.6.1 beyond their noise:
Engine download: 28% larger on the default engine and 32% on the full engine. A cold start
in Node without a cached engine is 23% slower for the same reason. Loading the code a page
needs first and the rest after it is planned for 0.8.0.
Cell editor: opening it takes 1.02–1.09× of 0.6.1's time, about 0.03 ms more at most, and
committing an edit at 1,000 rows on Linux 1.08×, about 0.07 ms more.
XLSX export memory on the Mac: after a collection, the rich and shared-style exports hold
2.60× and 1.62× of 0.6.1's memory. JavaScriptCore's pending background compilation holds it,
not Sheetwrite's objects; with that compilation off, they hold 1.11–1.13×.
Refusing a compression bomb: allocates 101 KB instead of 52 KB, three 16 KB heap blocks
that the first call sets up.
Small fixed rows: two formula retained-memory rows (+99 B and +3.8 KB), the 1,000-row data
edit, a cold first-edit formula row (1.05×), and one core-paths row of two samples, which an
isolated rerun puts at 0.76× of 0.6.1.
Each change against the code before it
The groups below give each change's own gain, measured against the code just before it, not
against 0.6.1. "0.25 of the time" means four times faster. A range covers both machines, or the
default and the full engine.
Formulas and recalculation
INDEX/MATCH lookups read only the cell they return: 200 lookups over 100,000 rows take
0.008 of the time on the Mac and 0.011 on Linux.
Formulas and recalculation, each change against the code before it
LinuxIntel Core i9-12900H
MacApple M5 Pro
RangeLowest to highest across machines and engines
Speed against the code before the change on the same machine, log scale: right of 1× is faster, left of 1× is slower. "0.5 of the time" plots at 2× faster.
1×10×100×1,000×
200 INDEX/MATCH lookups over 100,000 rows200 INDEX/MATCH lookups over 100,000 rowsLinux: 0.011 of the time; Mac: 0.008 of the timeLinux 0.011 of the timeMac 0.008 of the time
Append a table rowAppend a table rowRange: about 60× fasterRange about 60× faster
Redefine a name 100,000 formulas useRedefine a name 100,000 formulas useLinux: 19 ms instead of 491 msLinux 19 ms instead of 491 ms
COUNTIF with a number criterion, 100k cellsCOUNTIF with a number criterion, 100k cellsRange: 11.5–18× fasterRange 11.5–18× faster
SUM over two 100k rangesSUM over two 100k rangesRange: 2.15–6.62× fasterRange 2.15–6.62× faster
A LET in every rowA LET in every rowRange: 0.17–0.22 of the timeRange 0.17–0.22 of the time
MAP, REDUCE, BYROW and named LAMBDA callsMAP, REDUCE, BYROW and named LAMBDA callsRange: 0.41–0.64 of the timeRange 0.41–0.64 of the time
The dependency index for 100k formulas shrinks from 7.67 MB to 1.21 MB.
Charts and pivots
With 20,000 formula-backed charts, an unrelated edit and the chart refresh take 0.006 ms instead
of 20.2 ms on the Mac and 0.016 ms instead of 47.3 ms on Linux.
Charts and pivots, each change against the code before it
LinuxIntel Core i9-12900H
MacApple M5 Pro
RangeLowest to highest across machines and engines
Speed against the code before the change on the same machine, log scale: right of 1× is faster, left of 1× is slower. "0.5 of the time" plots at 2× faster.
1×100×10,000×
Unrelated edit with 20,000 formula-backed chartsUnrelated edit with 20,000 formula-backed chartsLinux: 0.016 ms instead of 47.3 ms; Mac: 0.006 ms instead of 20.2 msLinux 0.016 ms instead of 47.3 msMac 0.006 ms instead of 20.2 ms
Edit on another sheet, PivotTable field list openEdit on another sheet, PivotTable field list openMac: 12.95 µs instead of 1.629 msMac 12.95 µs instead of 1.629 ms
Pivot of measures over 100,000 rowsPivot of measures over 100,000 rowsRange: 0.66–0.71 of the timeRange 0.66–0.71 of the time
GETPIVOTDATA recalculates only when its pivot changes, as in Excel.
Paged and large data
A row insert in a 1,000,000-row paged sheet takes 0.0136–0.0221 of the time.
Paged and large data, each change against the code before it
LinuxIntel Core i9-12900H
MacApple M5 Pro
RangeLowest to highest across machines and engines
Speed against the code before the change on the same machine, log scale: right of 1× is faster, left of 1× is slower. "0.5 of the time" plots at 2× faster.
1×10×100×
Row insert, 1,000,000-row paged sheetRow insert, 1,000,000-row paged sheetRange: 0.0136–0.0221 of the timeRange 0.0136–0.0221 of the time
Drain 10,000 acknowledged editsDrain 10,000 acknowledged editsMac: 0.246 ms instead of 4.004 msMac 0.246 ms instead of 4.004 ms
Admit a 1,000,000-cell setBlockAdmit a 1,000,000-cell setBlockLinux: 65 ms instead of 617 ms; Mac: 17 ms instead of 212 msLinux 65 ms instead of 617 msMac 17 ms instead of 212 ms
Range formulas over loaded pagesRange formulas over loaded pagesRange: 3.0–3.1× fasterRange 3.0–3.1× faster
After a fast fling, cells show "loading" up to 74% less.
Grid and editing
Setting 100,000 row heights one at a time takes 0.49 s instead of 151.8 s on the Mac and
2.05 s instead of 340.8 s on Linux.
Grid and editing, each change against the code before it
LinuxIntel Core i9-12900H
MacApple M5 Pro
RangeLowest to highest across machines and engines
Speed against the code before the change on the same machine, log scale: right of 1× is faster, left of 1× is slower. "0.5 of the time" plots at 2× faster.
1×10×100×1,000×
Set 100,000 row heights one at a timeSet 100,000 row heights one at a timeLinux: 2.05 s instead of 340.8 s; Mac: 0.49 s instead of 151.8 sLinux 2.05 s instead of 340.8 sMac 0.49 s instead of 151.8 s
Paint a wrapped cell of 20,000 charactersPaint a wrapped cell of 20,000 charactersMac: 0.175 ms instead of 0.887 msMac 0.175 ms instead of 0.887 ms
Sort command on 1,000–4,000 numbersSort command on 1,000–4,000 numbersRange: 0.329–0.509 of the workRange 0.329–0.509 of the work
Scrolling with the cell editor open forces no style or layout work.
Import and export
CSV import takes 7.3% less time on the Mac and 11.0% less on Linux.
Import and export, each change against the code before it
LinuxIntel Core i9-12900H
MacApple M5 Pro
RangeLowest to highest across machines and engines
Speed against the code before the change on the same machine, log scale: right of 1× is faster, left of 1× is slower. "0.5 of the time" plots at 2× faster.
CSV importCSV importLinux: 11.0% less time; Mac: 7.3% less timeLinux 11.0% less timeMac 7.3% less time
XLSX export of 100,000 formulasXLSX export of 100,000 formulasLinux: 1,030 ms instead of 1,126 ms; Mac: 481 ms instead of 519 msLinux 1,030 ms instead of 1,126 msMac 481 ms instead of 519 ms
Download size
grid.css, the one stylesheet part every grid needs, is 4,666 B, where the old stylesheet was
89,452 B.
Shared sorts make the engines 13,307 B (default) and 16,248 B (full) Brotli smaller, and
writing number text without Rust's float formatting saves 6,784–7,113 B (default) and
5,561–5,563 B (full).
The query engine (85,351 B gzip) and the version comparison kernel (16,646 B gzip) load only
when they are used.
Breaking changes
The 0.7.0 upgrade guide lists every change with its
replacement. The changes most apps meet:
registerChartsBackend, registerXlsxBackends, the chart and XLSX backend setters and the
positional initSheetwrite(source, engine) are removed with the /register imports.
ChartView.chart is now the store's own definition, typed ReadonlyChartDefinition, and
development builds freeze it. Edit a copy from grid.getCharts(sheet) and commit it with
grid.setChart. The result of rebaseDocumentOperations can hold your own operations, so treat
it as read-only too. See Chart views are read-only.
Removed engine bindings
Direct @sheetwrite/wasm and @sheetwrite/formulas users must replace these bindings:
From 0.7.2, setColumnBlockCells, setBlockCells or setSparseCells, which take one string per cell; on 0.7.0 and 0.7.1, the raw setColumnBlockPacked, setBlockPacked or setSparseBlock
DiffKernel.clearPage
Consume the page arrays; the next compare starts a new page
DiffKernel.pageLength
Read the length of a returned page array
The scalar setters and clearCell, CellStore.rowCount / colCount, and
WindowView.nRows / nCols remain public APIs.
setSheetName now returns whether it named the sheet. Like renameSheet, it refuses an empty
name, a name another sheet holds in any case, and another sheet's id.
Excel's keys, search, paste and validation
A host key that uses a new default key, such as Ctrl+B, Ctrl+1 or Ctrl+Alt+V, now throws
shortcut-conflict. Rebind the action or set it to null. See
Keyboard defaults.
A selection's active cell is the cell it started from, reported as active.
Cut no longer empties its cells; the paste moves them with the new moveCells operation, and
the "cut" commit reason is gone. Servers that check operation kinds must accept it.
Search treats * and ? as wildcards, looks in formulas unless lookIn: "values", and
searches only a selection of more than one cell. A number in a number format matches by its
text, and Find selects the match.
A paste brings the copied cells' validation rules. paste.keepValidation: true keeps the
target's rules, as 0.6 did.
DataValidationCondition, ColumnFilter and SheetNameIssueCode have new members.
New general column type
Columns Sheetwrite makes are general, not text, and read typing as Excel's General format
does. Handle general where your code switches on Column.type, and update collaborating
clients together: a 0.6 peer refuses a snapshot or patch with a general column. See
Editing, filters and sheets.
Errors and cancellation
Bad input and passed limits throw a SheetwriteError (invalid-argument, not-found,
invalid-limits) instead of RangeError, TypeError or Error.
Aborted XLSX, CSV, comment and sync calls reject with the signal's reason.
A WebAssembly trap throws engine-failed and makes every grid on that engine read-only.
Direct XLSX formula conversion
From 0.7.2, direct callers of @sheetwrite/wasm or @sheetwrite/formulas convert a list of
formulas with one call, which returns every formula in input order:
formulasFromXlsx reads them back, and setSparseCells takes one string per entry, as
setSparseBlock did in 0.6. The raw convertXlsxFormulas stays as the low-level transport: it
takes joined sources, cumulative UTF-16 ends and a changed-index buffer, and returns only the
changed formulas; 0.7.0 and 0.7.1 have only the raw call. The scalar formulaToXlsx and
formulaFromXlsx exports are removed; pass a list of one formula instead. Core's
XlsxFormulaEngine.convert keeps its array interface. See
Direct engine calls.
Open the guidefunction chartsAddon(): SheetwriteAddonfunctionchartsAddon():SheetwriteAddonfunctionchartsAddon():SheetwriteAddonThe charts add-on. It makes core's openChartViews(store) return live chart views, and grids created after initSheetwrite draw their charts as SVG. Without it, a grid shows a plain frame with the chart title. The SVG code loads when the first grid is created, not with the first chunk.ExampleAPI referencefunction initSheetwrite(options?: InitSheetwriteOptions): Promise<void>functioninitSheetwrite(options?:InitSheetwriteOptions,):Promise<void>functioninitSheetwrite(options?:InitSheetwriteOptions,):Promise<void>Load one WASM engine and install add-ons before createGrid.See also/docs/start/choose-an-engine/, createGrid·ExampleAPI referencemodule "@sheetwrite/formulas"module"@sheetwrite/formulas";module"@sheetwrite/formulas";Cells that hold a formula, as row-major offset and source text such as =A1*2.API referencefunction xlsxAddon(): SheetwriteAddonfunctionxlsxAddon():SheetwriteAddonfunctionxlsxAddon():SheetwriteAddonThe XLSX add-on. It installs the workbook and table XLSX backends that core's fromXlsx* and toXlsx* functions and grid.exportXlsx use. The codec loads on the first XLSX call, so installing the add-on at startup adds no codec code to the first chunk.See also/docs/import-export/xlsx-export/·ExampleAPI referenceInitSheetwriteOptions.engine?: SheetwriteEngine | undefinedinterfaceInitSheetwriteOptions{engine?:SheetwriteEngine|undefined;}interfaceInitSheetwriteOptions{engine?:SheetwriteEngine|undefined;}Engine module; defaults to @sheetwrite/wasm. Pass @sheetwrite/formulas for the full engine.API referenceInitSheetwriteOptions.addons?: readonly SheetwriteAddon<unknown>[] | undefinedinterfaceInitSheetwriteOptions{addons?:readonlySheetwriteAddon<unknown>[]|undefined;}interfaceInitSheetwriteOptions{addons?:|readonlySheetwriteAddon<unknown>[]|undefined;}Add-ons to install, in this order, after the engine loads. A name listed twice rejects; a name installed by an earlier call is kept.API referenceinterface GridinterfaceGridinterfaceGridImperative grid handle for document commands, events, rendering, and teardown.See alsocreateGrid, Grid.applyTransaction·ExampleAPI referencefunction sortByRegion(grid: Grid): voidfunctionsortByRegion(grid:Grid):voidfunctionsortByRegion(grid:Grid,):voidAPI referencegrid: Gridlet grid:Gridlet grid:GridAPI referenceGrid.sortBy(col: number, ascending?: boolean): ApplyTransactionResultGrid.sortBy(col: number, ascending?: boolean): ApplyTransactionResultGrid.sortBy(col: number, ascending?: boolean): ApplyTransactionResultSort by column col, as Excel's quick sort does. It sorts the cells of the table body that holds the focus cell, or else of the selected range, or else of the current region around the focus cell. A first row of text over other values stays as a header.See alsoGrid.sortRange·ExampleAPI referenceGrid.setViewSort(keys: readonly SortKey[]): ApplyTransactionResultGrid.setViewSort(keys: readonly SortKey[]): ApplyTransactionResultGrid.setViewSort(keys: readonly SortKey[]): ApplyTransactionResultSort the rows shown on the active sheet without moving any cell. Rows sort by keys (first key primary; stable); an empty list clears the view sort. The keys are saved with the sheet and export to XLSX as sortState.See alsoGrid.clearView·ExampleAPI referenceSortKey.col: numberinterfaceSortKey{col:number;}interfaceSortKey{col:number;}Zero-based index of the column to sort by.API referenceSortKey.ascending: booleaninterfaceSortKey{ascending:boolean;}interfaceSortKey{ascending:boolean;}true sorts smallest first (A to Z for text); false the reverse.API referenceclass SyncCoordinatorclassSyncCoordinatorclassSyncCoordinatorKeeps a document in sync with a server while edits show at once. The sync is deterministic, optimistic and works over any transport. Local rendering is never blocked: changes queue immediately, while hosts explicitly call sendNext or retry to perform network work.See alsoPersistenceAdapter, SyncCoordinator.recoverConflict·ExampleAPI referenceclass HistoryArchiveclassHistoryArchiveclassHistoryArchiveOpt-in archive of named and automatic versions for one document. It stores content-addressed checkpoints plus the committed transactions since each one, through a host HistoryStorageAdapter. A grid that never imports this module has no history state. Calls that change the archive run one at a time. Each publishes atomically, so a failure or abort leaves the last durable version readable.API referenceinterface HistoryStorageAdapterinterfaceHistoryStorageAdapterinterfaceHistoryStorageAdapterAtomic storage seam for local databases and host-owned history backends.API referencefunction restoreLatest(grid: Grid, sync: SyncCoordinator, storage: HistoryStorageAdapter): Promise<ApplyTransactionResult | undefined>functionrestoreLatest(grid:Grid,sync:SyncCoordinator,storage:HistoryStorageAdapter,):Promise<ApplyTransactionResult|undefined>functionrestoreLatest(grid:Grid,sync:SyncCoordinator,storage:HistoryStorageAdapter,):Promise<|ApplyTransactionResult|undefined>const archive: HistoryArchiveconst archive:HistoryArchiveconst archive:HistoryArchiveAPI referenceHistoryArchive.open(options: HistoryArchiveOptions, signal?: AbortSignal): Promise<HistoryArchive>HistoryArchive.open(options: HistoryArchiveOptions, signal?: AbortSignal): Promise<HistoryArchive>HistoryArchive.open(options: HistoryArchiveOptions, signal?: AbortSignal): Promise<HistoryArchive>Open an archive by reading its manifest only; no workbook is loaded.API referenceHistoryArchiveOptions.documentId: stringinterfaceHistoryArchiveOptions{documentId:string;}interfaceHistoryArchiveOptions{documentId:string;}ID of the document whose history the archive keeps.API referenceHistoryArchiveOptions.storage: HistoryStorageAdapterinterfaceHistoryArchiveOptions{storage:HistoryStorageAdapter;}interfaceHistoryArchiveOptions{storage:HistoryStorageAdapter;}Where the archive stores its records, such as IndexedDB storage from @sheetwrite/core/browser-history.const versions: readonly HistoryVersion[]const versions:readonlyHistoryVersion[]const versions:readonlyHistoryVersion[]Version markers on this page, newest first.API referenceHistoryArchive.listVersions(options?: ListVersionsOptions): Promise<HistoryListPage>HistoryArchive.listVersions(options?: ListVersionsOptions): Promise<HistoryListPage>HistoryArchive.listVersions(options?: ListVersionsOptions): Promise<HistoryListPage>One bounded page of version metadata, newest first.API referenceListVersionsOptions.maxEntries?: number | undefinedinterfaceListVersionsOptions{maxEntries?:number|undefined;}interfaceListVersionsOptions{maxEntries?:number|undefined;}Changes per page, from 1 to 1,000; default 1,000.API referenceconst latest: HistoryVersionconst latest:HistoryVersionconst latest:HistoryVersionAPI referenceconst versions: readonly HistoryVersion[]const versions:readonlyHistoryVersion[]const versions:readonlyHistoryVersion[]Version markers on this page, newest first.API referenceundefined: undefinedlet undefined:undefinedlet undefined:undefinedHistoryArchive.restoreVersion(grid: Grid, id: string, scope: HistoryRestoreScope, options?: HistoryRestoreOptions): Promise<ApplyTransactionResult>HistoryArchive.restoreVersion(grid: Grid, id: string, scope: HistoryRestoreScope, options?: HistoryRestoreOptions): Promise<ApplyTransactionResult>HistoryArchive.restoreVersion(grid: Grid, id: string, scope: HistoryRestoreScope, options?: HistoryRestoreOptions): Promise<ApplyTransactionResult>Restore one version, or one sheet or range of it, on grid as one undoable transaction. The version is rebuilt in a private engine instance, or taken from the last readVersion or restore, and compared with the grid's current document; the difference is committed as one atomic restore, which SyncCoordinator sends as one transaction that is never rebased. With options.sync, the coordinator must be online with no pending or conflicted commits. When its server version is the archive head, the grid holds the head, so only the checkpoint pages where the version and the head differ are read and written again (see selectRestorePages). A change to the grid while the version is read, or a scope that cuts a merged cell or hyperlink, rejects before anything changes. See the restore section of the persistence guide for what each scope covers.API referenceHistoryVersion.id: stringinterfaceHistoryVersion{id:string;}interfaceHistoryVersion{id:string;}Content ID of the marker fields.API referencekind: "workbook"let kind:"workbook"let kind:"workbook""dashboard" adds a dashboard, which ignores rowCount and columns.API referenceHistoryRestoreOptions.sync?: SyncCoordinator | undefinedinterfaceHistoryRestoreOptions{sync?:SyncCoordinator|undefined;}interfaceHistoryRestoreOptions{sync?:SyncCoordinator|undefined;}The grid's coordinator in a shared document; the restore then needs an idle queue.function createEngine(source?: Parameters<typeof load>[0]): Promise<EngineInstance>functioncreateEngine(source?:Parameters<typeof load>[0],):Promise<EngineInstance>functioncreateEngine(source?:Parameters<typeof load>[0],):Promise<EngineInstance>Initialize a fresh engine; a compiled module can be reused without retaining its memory.Parametersource - Where the engine's WASM comes from, as for load; pass a compiled WebAssembly.Module to reuse it.ReturnsThe new engine, with its own memory; retire() releases it.API referencefunction formulasToXlsx(engine: Pick<typeof import("../../../../node_modules/@sheetwrite/wasm/pkg/sheetwrite_wasm.js"), "convertXlsxFormulas">, formulas: readonly string[]): string[]functionformulasToXlsx(engine:Pick<typeofimport("../../../../node_modules/@sheetwrite/wasm/pkg/sheetwrite_wasm.js"),"convertXlsxFormulas">,formulas:readonlystring[],):string[]functionformulasToXlsx(engine:Pick<typeofimport("../../../../node_modules/@sheetwrite/wasm/pkg/sheetwrite_wasm.js"),"convertXlsxFormulas">,formulas:readonlystring[],):string[]The formulas in XLSX spelling, such as =_xlfn.CONCAT(A1, B1) for =CONCAT(A1, B1), in input order. It calls convertXlsxFormulas once for the whole list; only the changed formulas come back from WASM.Parameterengine - The loaded package, or an engine from createEngine.Parameterformulas - The formulas in editor spelling.ReturnsOne formula for each input; an unchanged formula is the input string.See also/docs/start/choose-an-engine/#call-the-engine-directlyconst engine: EngineInstanceconst engine:EngineInstanceconst engine:EngineInstanceconst saved: string[]const saved:string[]const saved:string[]function retire(): voidfunctionretire():voidfunctionretire():voidDrop all glue roots after releasing owned resources. This instance is then unusable.