Spreadsheet APISpreadsheet
Options, methods and events of createSpreadsheet, and the other exports of @birchui/spreadsheet.
createSpreadsheet(container, options) renders a spreadsheet into container and returns a SpreadsheetApi. This page lists every option, method and event. The complete generated reference, with every type, is on the @birchui/spreadsheet API page.
import { createSpreadsheet } from '@birchui/spreadsheet';
const sheet = createSpreadsheet(document.querySelector<HTMLElement>('#model')!, {
data: model,
height: 600,
licenseKey: import.meta.env.VITE_BIRCHUI_LICENSE_KEY,
});Options#
| Option | Default | Effect |
|---|---|---|
data |
one empty sheet | The workbook to load, as WorkbookJSON. |
licenseKey |
the key from setLicenseKey() |
Your Spreadsheet or Complete license key. |
height |
the container's height | A number of pixels or a CSS length, such as '70vh'. |
theme |
inherited from the page | 'light', 'dark' or 'auto', which follows the operating system. |
sheetTheme |
'light' |
What the cells do in a dark theme. 'light' keeps the sheet area white, as Excel does, and only the toolbar, formula bar, headers, tabs, menus and dialogs go dark. 'match' makes the cells dark too. See Themes. |
readOnly |
false |
Users can select, copy and search but not edit. |
toolbar |
'ribbon' |
The toolbar: 'ribbon', 'compact' or false. |
toolbarOptions |
none | Hide tabs and commands, add custom buttons, turn Alt key tips off. |
ribbon |
{ mode: 'classic' } |
Ribbon layout: mode is 'classic', 'simplified' (one row), 'collapsed' (tabs only) or 'auto'. |
pasteOptionsButton |
true |
Show the Paste options button after a paste. |
spellcheck |
none | A function (text, language) => issues used by Review > Spelling. |
datePicker |
true |
Open a calendar on date cells by double click or Alt + Down. See Date picker. |
csvImportDialog |
true |
Ask for delimiter, encoding and locale when a CSV file is opened from the File tab or dropped. |
errorChecking |
true |
Mark numbers stored as text, inconsistent formulas and formulas that omit adjacent cells. See Error checking. |
autoComplete |
true |
Propose the matching entry of the same column while text is typed in a cell. |
formulaBar, sheetTabs, statusBar |
true |
Show the formula bar with the name box, the sheet tab bar, and the status bar with the selection statistics and the zoom slider. |
zoom |
100 |
Zoom in percent, from 10 to 400. |
userName |
none | The author recorded on new comments and replies. |
headings |
true |
Show row numbers and column letters. |
gridlines |
true |
Draw cell gridlines. |
defaultColumnWidth, defaultRowHeight |
88, 22 |
Default sizes in pixels. |
dynamicArrays |
true |
false turns spilling off and uses implicit intersection. |
iterativeCalculation |
false |
true, or { maxIterations, maxChange }, for circular models. |
now |
the system clock | The time used by NOW and TODAY. |
injectStyles |
true |
Set false and import @birchui/spreadsheet/styles.css yourself. |
ariaLabel |
'Spreadsheet' |
The accessible name of the grid. |
customLists |
none | Extra autofill lists, such as [['North', 'South', 'East', 'West']]. |
resolveImage |
none | Supplies the picture for an IMAGE formula as a data: or blob: URL. Without it IMAGE returns #BLOCKED!; nothing is fetched. |
calculation, calculationWorker |
'sync' |
'worker' evaluates formulas in the Web Worker created by calculationWorker. See worker calculation. |
functions |
none | Custom functions for formulas, as a map or an array of definitions. |
validation |
'ui' |
'ui' checks data validation on typed input only. 'always' also checks paste, fill, flash fill, replace and API writes. |
enforceProtection |
false |
true makes sheet and workbook protection bind API calls as well as the user interface. |
fileDrop |
true |
Dropping a spreadsheet file on the widget opens it. false leaves file drags to the page. |
locale, localizedFormulas |
en-US | A locale for separators, month and day names and typed input: 'de-DE', 'fr-FR', 'es-ES' or a locale object. localizedFormulas: true also shows and accepts formulas in that locale's syntax. |
update(partial) changes options in place. A new data loads a workbook and clears the undo history; a new licenseKey is verified again; dynamicArrays, iterativeCalculation and now trigger a full recalculation. calculation and calculationWorker switch between main-thread and worker calculation. functions replaces the functions that came from the option, and validation and enforceProtection take effect on the next write.
Methods#
Cells#
| Method | Purpose |
|---|---|
getValue(address), setValue(address, value) |
Read or write one cell. Strings are interpreted like typed input; a Date becomes a date serial. |
getFormula(address), setFormula(address, formula) |
Read or write a formula. |
getDisplayText(address) |
The text the cell shows, with its number format applied. |
getRange(range), setRange(range, values) |
Read or write a block with a 2D array. setRange needs only the top-left cell and recalculates once. |
clearRange(range) |
Clear values and formulas, keeping formatting. |
Addresses and ranges accept a sheet prefix, such as 'Q3 Budget'!B4, or a defined name; without one they refer to the active sheet.
Write options#
The methods that change cells, formatting, structure or sheets take an optional last argument, { force?: boolean }. It matters only with validation: 'always', with enforceProtection: true, or while the workbook structure is protected: force: true makes that one call skip those checks.
sheet.setValue('B4', 1250, { force: true });
sheet.setStyle('A1:F1', { bold: true }, 'merge', { force: true });
sheet.insertRows(12, 3, { force: true });The argument comes after the method's other arguments, so the optional ones before it must be given or passed as undefined: addSheet('Actuals', undefined, { force: true }).
| Group | Methods that take { force } |
|---|---|
| Cells | setValue, setFormula, setRange, clearRange, replaceAll, autoSum, flashFill, textToColumns, removeDuplicates, subtotal, removeSubtotals, pasteSpecial, pasteValues, applyPasteOption |
| Formatting | setStyle, setCellControl, applyCellStyle, mergeCells, unmergeCells, setColumnWidth, setRowHeight, hideRows, unhideRows, hideColumns, unhideColumns |
| Structure | insertRows, deleteRows, insertColumns, deleteColumns, insertCells, deleteCells, sortRange, sortRangeBy, setAutoFilter |
| Sheets | addSheet, removeSheet, renameSheet, moveSheet, setSheetHidden, duplicateSheet |
A blocked call throws a ValidationError or a ProtectionError, both exported from the package, and changes nothing.
Formatting and layout#
| Method | Purpose |
|---|---|
getStyle(address), setStyle(range, style, mode?) |
Read or write styles. |
getCellControl(address), setCellControl(range, control) |
Read or set the cell control: 'checkbox', 'dropdown' or null to remove it. |
formatEditorSelection(format) |
Format the text selected in the open cell editor as rich text. Returns false when no text edit is open. |
mergeCells(range), unmergeCells(range) |
Merge and unmerge. |
setColumnWidth(column, width), setRowHeight(row, height) |
Sizes in pixels; columns by letter or 1-based number, rows by 1-based number. |
setFreeze(rows, columns) |
Freeze panes on the active sheet; 0, 0 unfreezes. |
splitPanes(cell?), removeSplit() |
Split the grid above and left of a cell into panes that scroll on their own, or remove the split. |
Structure and data#
| Method | Purpose |
|---|---|
insertRows(row, count?), deleteRows(row, count?) |
Insert or delete rows at a 1-based row on the active sheet. |
goTo(reference), selectSpecial(kind, range?) |
Select a cell, range, list of ranges or defined name; select the cells of one kind ('blanks', 'constants', 'formulas', 'errors', 'visibleCells', 'currentRegion', 'conditionalFormats', 'dataValidation', 'notes', 'lastCell') and return the selected ranges. |
insertCells(range, shift?), deleteCells(range, shift?) |
Insert blank cells at range and push the existing ones 'down' (default) or 'right', or delete the cells of range and pull the following ones 'up' (default) or 'left'. Only the columns (or rows) of the range move. Returns false when the sheet is read-only or protected, or when the range would cut a merged cell, a table, a filtered range, a PivotTable or a data table in two; the error event says which. |
insertColumns(column, count?), deleteColumns(column, count?) |
The same for columns, by letter or 1-based number. |
sortRange(range, column, descending?) |
Sort a range by one column. |
setAutoFilter(range) |
Turn on an autofilter, or pass null to remove it. |
addConditionalFormat(rule, sheet?), clearConditionalFormats(sheet?), getConditionalFormats(sheet?), setConditionalFormats(rules, sheet?) |
Conditional formatting. |
addValidation(rule, sheet?), clearValidations(sheet?) |
Data validation. |
find(text, options?), replaceAll(text, replacement, options?) |
Find and replace. |
Sheets and names#
| Method | Purpose |
|---|---|
getSheetNames(), getActiveSheet(), setActiveSheet(name) |
List and switch sheets. |
addSheet(name?, index?), removeSheet(name), renameSheet(name, newName), moveSheet(name, index), setSheetHidden(name, hidden) |
Manage sheets. |
duplicateSheet(name, newName?) |
Copy a sheet next to the original; returns the name of the copy. Throws when the new name is invalid or taken. |
setTabColor(name, color) |
Set the tab colour, or remove it with null. |
getSheetView(sheet?), setSheetView(view, sheet?) |
Read and change the sheet view: zoom, gridlines, headings, direction and zero values. A key set to undefined is removed. |
defineName(name, formula, sheet?) |
Add or change a defined name. |
Selection, history and calculation#
| Method | Purpose |
|---|---|
select(range), getSelection() |
Select a range, switching sheet if needed and scrolling it into view; read the selection. |
undo(), redo(), canUndo(), canRedo() |
Undo and redo. |
recalculate() |
Recalculate every formula, calling async custom functions again. Returns { changedCount, ms }. |
whenCalculated() |
A promise that resolves when no calculation is outstanding. It resolves at once unless worker calculation is on or an async custom function is pending. |
registerFunction(name, impl, options?), unregisterFunction(name) |
Add or remove a custom function on this spreadsheet. registerFunction throws for an invalid name. |
listFunctions() |
The built-in functions plus this spreadsheet's custom ones, which have category: 'custom'. |
getCalculationMode() |
'sync' or 'worker': where formulas are evaluated right now. |
getRibbonMode() |
{ mode, resolved }: the ribbon mode asked for and the layout on screen. |
Tables, outline and protection#
| Method | Purpose |
|---|---|
addTable(range, options?), removeTable(name), updateTable(name, changes), resizeTable(name, range) |
Create and manage tables. removeTable converts the table to a plain range. |
getTables(sheet?), getTable(name) |
Read tables as TableJSON. |
groupRows(first, last), ungroupRows(first, last), groupColumns(first, last), ungroupColumns(first, last) |
Outline grouping. |
collapseGroup(axis, index), expandGroup(axis, index), showOutlineLevel(axis, level) |
Collapse and expand groups, or show one outline level. |
protectSheet(options?, sheet?), unprotectSheet(password?, sheet?), isSheetProtected(sheet?) |
Sheet protection. Passwords are stored only as salted SHA-512 hashes. |
protectWorkbook(password?), unprotectWorkbook(password?), isWorkbookProtected(), isCellLocked(address) |
Workbook structure protection and cell lock state. |
Notes, links and drawings#
| Method | Purpose |
|---|---|
setNote(address, note), getNote(address), getNotes(sheet?) |
Notes. Pass null to remove one. |
setHyperlink(address, link), getHyperlink(address), followHyperlink(address) |
Web, email and in-workbook hyperlinks. |
addImage(image, sheet?), updateImage(id, changes), removeImage(id), getImages(sheet?) |
Pictures from data: or blob: URLs. |
setCellImage(address, image), getCellImage(address) |
Pictures in cells. Pass null to remove one. |
insertEmbeddedObject(object, sheet?), updateEmbeddedObject(id, changes), removeEmbeddedObject(id), getEmbeddedObjects(sheet?), getEmbeddedObjectData(id), getEmbeddedObjectType(id), openEmbeddedObject(id), downloadEmbeddedObject(id) |
Embedded files and the type detected for each. |
addChart(chart, sheet?), updateChart(id, changes), removeChart(id), getCharts(sheet?) |
Charts that follow their source ranges. |
addSparklines(group, sheet?), clearSparklines(range?, sheet?), getSparklines(sheet?) |
Sparklines. |
Printing, auditing and tools#
| Method | Purpose |
|---|---|
setPageSetup(setup, sheet?), getPageSetup(sheet?), setPageBreak(axis, index, on?) |
Page setup, print area, titles and manual page breaks. |
print(options?), getPrintHtml(options?) |
Print through the browser, or get standalone print HTML. |
getPrecedents(address), getDependents(address) |
Direct precedents and dependents as addresses. |
tracePrecedents(address?), traceDependents(address?), clearArrows() |
Trace arrows on the grid. |
evaluateFormulaSteps(address) |
The steps of Evaluate Formula, as { formula, evaluated, value }. |
listCellStyles(), applyCellStyle(range, name) |
The cell styles gallery. |
autoSum(range?) |
Insert SUM like Alt + =. |
openDialog(dialog) |
Open a built-in dialog or panel. The names are listed under keyboard shortcuts. |
getNames(), removeName(name, sheet?) |
List and delete defined names. |
getProperties(), setProperties(properties) |
The document properties of the workbook (title, subject, author, manager, company, category, keywords, status, description and more, see DocumentProperties). setProperties merges the given keys, removes a key set to an empty string, and is one undo step. The same data is in WorkbookJSON.properties and in the Review > Properties dialog. |
Comments#
| Method | Purpose |
|---|---|
setComment(address, comment), getComment(address), getComments(sheet?) |
Threaded comments. Pass text, a full thread, or null to delete. |
addCommentReply(address, reply), resolveComment(address, resolved?) |
Reply to a thread, and resolve or reopen it. |
Pivot tables, slicers and shapes#
| Method | Purpose |
|---|---|
insertPivotTable(definition, sheet?), updatePivotTable(name, changes), refreshPivotTable(name?), removePivotTable(name), getPivotTables(sheet?) |
Pivot tables. |
drillDownPivot(address) |
Add a sheet with the source rows behind a pivot value; returns its name. |
addSlicer(slicer, sheet?), updateSlicer(id, changes), removeSlicer(id), getSlicers(sheet?) |
Slicers. |
addShape(shape, sheet?), updateShape(id, changes), removeShape(id), getShapes(sheet?) |
Shapes and text boxes. |
Data tools and view#
| Method | Purpose |
|---|---|
sortRangeBy(range, levels, options?) |
Multi-level sort with custom lists. |
setColumnFilter(column, condition) |
Filter a column by condition, rank, colour, date or values; null clears it. |
removeDuplicates(range, options?) |
Remove repeated rows; returns how many were removed. |
textToColumns(range, options?) |
Split one column into several. |
flashFill(range?) |
Fill a column from the pattern of your examples; returns the number of cells filled. |
subtotal(range, options), removeSubtotals(range) |
Insert or remove subtotal rows with an outline. |
goalSeek(options) |
Find the input that makes a formula reach a target. |
addDataTable(table), removeDataTable(range, options?), getDataTables(sheet?) |
Data tables for what-if analysis with one or two input cells. |
pasteSpecial(options?), setFormatPainter(mode) |
Paste values, formulas or formats, optionally transposed; turn the format painter on, off or 'locked'. |
pasteValues(), getPasteOptions(), applyPasteOption(option) |
Paste the copied cells as values; read the options of the paste that was just made ({ current, available }, or undefined once the workbook changed again); rewrite that paste as 'all', 'values', 'formulas', 'formats', 'transpose', 'columnWidths' or 'link'. |
hideRows(first, last?), unhideRows(first, last?), hideColumns(first, last?), unhideColumns(first, last?) |
Hide and show rows and columns. |
setZoom(percent), getZoom() |
Zoom the grid. |
Files#
| Method | Purpose |
|---|---|
toJSON(), fromJSON(json) |
Save and load the workbook JSON. |
importXlsx(data, options?) |
Load an Excel file from a Blob, File, ArrayBuffer or Uint8Array. A legacy .xls file is recognised by its content and opened too. The options are password for an encrypted file, onProgress and signal to follow or cancel the import, and limits and xlsLimits. |
exportXlsx(options?), downloadXlsx(fileName) |
Write an Excel file as a Uint8Array, or download it. The options are compress and password, which encrypts the file. |
importCsv(data, options?), exportCsv(options?) |
Load CSV or TSV text or bytes as a one-sheet workbook; return the active sheet, or the one named in sheet, as CSV text. Both are synchronous. |
importOds(data, options?), exportOds(options?) |
Load and write OpenDocument spreadsheets. Both return promises. |
exportPdf(options?), downloadPdf(fileName, options?) |
Write a vector PDF of the active sheet, or of the sheets named in sheets, as a Uint8Array, or download it. No print dialog. |
openFile(file, fileName?, options?), saveAs(format, fileName?), getFileName() |
What the File tab does: open an xlsx, xls, CSV or ods file after detecting its format (options.password opens a password-protected xlsx without a dialog), and download the workbook as 'xlsx', 'csv', 'ods' or 'pdf'. Both fire a cancellable event first and resolve to false when a listener cancelled. getFileName() is the name of the opened file without its extension, workbook until a file is opened. |
getImportReport() |
The report of the last importXlsx(): { modelled, preserved, dropped }, each a list of { feature, sheet?, count?, parts?, elements?, note? }. modelled is what was read into the workbook and can be edited, preserved is kept unchanged for export, dropped is not kept. It is undefined before the first import and after fromJSON() or update({ data }). Review > Import report and openDialog('importReport') show it. |
Collaboration#
| Method | Purpose |
|---|---|
onOperation(listener) |
Call listener({ operation, origin: 'local' }) for every local edit, including undo and redo. Returns a function that stops listening. See Operations. |
applyRemoteOperation(operation) |
Apply an operation from another user without emitting it and without an undo step. Returns false, and fires error with code: 'collaboration', when the operation is invalid or does not fit the workbook. |
setPresence(cursors), getPresence() |
Draw and read other users' cursors: { id, name, color?, sheet, active, ranges? }. |
Like every Birch UI widget, the API also has element, update(partial), on(event, listener) and destroy(). Changes made through the API are undoable, like user edits.
Events#
| Event | Payload | When |
|---|---|---|
ready |
{ api } |
Once, right after creation. |
cellChange |
{ sheet, address, oldValue, newValue, formula?, source } |
A cell's content changed. source is edit, api, paste, fill, undo, redo, replace, clear, sort or remote (an operation from another user). Not fired for cells that only recalculated. |
selectionChange |
{ sheet, active, ranges } |
The selection moved. active is the active cell, ranges the selected ranges. |
sheetChange |
{ sheet, action, previous? } |
A sheet was activated, added, removed, renamed, moved, hidden or shown. |
recalculated |
{ changedCount, ms } |
A recalculation finished. |
error |
{ code, message, sheet?, address? } |
Something the user should know about, see below. |
hyperlinkClick |
{ sheet, address, url?, location?, preventDefault() } |
A hyperlink is about to be followed. Call preventDefault() to handle it yourself. |
viewportScroll |
{ sheet, top, left, firstRow, firstColumn } |
The grid scrolled. |
zoomChange |
{ zoom } |
The zoom level changed, in percent. Also fired when a sheet with a different zoom of its own is activated. |
pivotTableRefreshed |
{ sheet, name, range } |
A pivot table rewrote its cells. |
embeddedObjectOpen |
{ sheet, id, fileName, mimeType, progId, fileType, data } |
The user opened an embedded file, or openEmbeddedObject() was called. data holds the file bytes; fileName, mimeType and fileType come from the detected type. |
importReport |
{ report } |
importXlsx() finished. report holds the same lists getImportReport() returns. Not fired by importCsv() or importOds(). |
beforeOpen |
{ fileName, format, data, source, preventDefault() } |
A file is about to be opened from the File tab (source: 'picker'), by a drop ('drop') or by openFile() ('api'). format is 'xlsx', 'xls', 'csv' or 'ods'; data holds the bytes. preventDefault() leaves the workbook as it is. |
beforeSave |
{ fileName, format, preventDefault() } |
A download is about to start from the File tab or saveAs(). format is 'xlsx', 'csv', 'ods' or 'pdf'. preventDefault() stops it, so you can save the bytes yourself. Not fired by downloadXlsx() and downloadPdf(). |
ribbonModeChange |
{ mode, resolved, source } |
The ribbon layout changed through the display menu, Ctrl + F1 or a double click on a tab (source: 'user'), or 'auto' picked another layout after a resize (source: 'resize'). Not fired by update(). |
sheet.on('selectionChange', ({ active, ranges }) => {
selectionLabel.textContent = `${active} (${ranges.join(', ')})`;
});Errors thrown by your listeners are caught and logged with console.error, so they cannot break the spreadsheet.
Error codes#
code |
Cause |
|---|---|
circularReference |
A formula refers to itself, directly or indirectly. |
validation |
Input broke a validation rule. With validation: 'always' this also covers a rejected API write and cells skipped by a paste, fill or replace. |
formula |
A command could not run: a formula with a syntax error, an unknown reference in the name box, an invalid sheet name, removing or hiding the last visible sheet, a command on a multiple selection, or blocked clipboard access. Also a custom function that threw or whose promise rejected; sheet and address name the cell. |
import, export |
A file could not be read or written: xlsx, CSV or ods. This includes a missing or wrong password and a cancelled import. The rejected promise carries the original error. |
readOnly |
A user tried to edit a read-only spreadsheet. |
protected |
A user action was blocked by sheet or workbook protection, or a password was wrong. With enforceProtection: true, an API call that was blocked. |
table |
A table could not be created or changed, for example because it would overlap another table. |
dataTable |
A data table could not be created, or an edit was refused because the cell holds a data table result. |
collaboration |
A remote operation was invalid or could not be applied, or undo had nothing left because remote edits removed the steps. |
The same messages are announced to screen readers.
Other exports#
| Export | Purpose |
|---|---|
spreadsheetDefinition |
The widget definition for the framework adapters; tag name birchui-spreadsheet. |
SPREADSHEET_EVENT_NAMES |
The list of event names. |
createFormulaEngine(options?) |
The headless engine. |
createWorkerEngine(options), exposeFormulaEngine(options?) |
The engine in a Web Worker. |
connectCollaboration(sheet, provider, options) |
Join a collaboration session through a provider. |
createCollaborationAuthority(options?) |
The server-side function that orders and transforms operations. No DOM. |
createLoopbackProvider(options?) |
An in-memory authority and transport for tests, demos and spreadsheets on one page. |
transform(operation, against, order?), transformAll(operations, against, order?), parseOperation(input) |
The transformation and the operation validator, for servers and providers of your own. order says whether operation was ordered 'after' (the default) or 'before' against. |
xlsxToJSON(data, options?), jsonToXlsx(json, options?) |
xlsx conversion without the component. The options include password, and for imports onProgress and signal. |
xlsxToJSONWithReport(data, options?), inspectXlsx(data, options?) |
The workbook together with its import report, or the report alone. |
validateXlsxPackage(bytes, options?) |
Check an xlsx file for structural mistakes. |
renderMetafile(bytes) |
Converts an EMF or WMF picture to SVG, as the grid does for Windows metafiles. |
detectEmbeddedFileType(bytes, hints?) |
The type of a file from its bytes and optional hints (progId, fileName, contentType, partName), as { kind, label, badge, extension, mime }. No DOM; it never throws. |
canvasImageRasterizer |
The rasterizer the browser export uses for SVG and WebP pictures. |
isEncryptedPackage(bytes), describeEncryption(bytes) from @birchui/spreadsheet/encryption |
Whether a file is password-protected, and with which cipher, key size, hash and iteration count. |
csvToJSON(data, options?), jsonToCsv(json, options?) |
CSV and TSV conversion. |
detectCsvDialect(text), readCsvDialect(data, encoding?), parseCsv(text, options?) |
The detected delimiter, quote, line ending and encoding of delimited text, and the parser alone. See What is detected. |
odsToJSON(data, options?), jsonToOds(json, options?) |
OpenDocument conversion. |
xlsToJSON(data, options?), xlsToJSONWithReport(data, options?), isXlsWorkbook(bytes), XlsError, DEFAULT_XLS_LIMITS |
Read legacy .xls files of Excel 97-2003. Synchronous, no DOM. There is no .xls export. |
jsonToPdf(json, options?) |
PDF export without the component or a DOM. |
jsonToXlsxWithReport(json, options?) |
The xlsx bytes together with a report of what the exporter adjusted. |
sanitizeWorkbook(json), safeColor(value), safeFontFamily(value), safeLinkUrl(value), safeImageSource(value) |
The checks applied to untrusted workbooks. |
DataTableError |
Thrown by addDataTable() for a definition that cannot work. See Data tables. |
ZipLimitError, DEFAULT_ZIP_LIMITS |
The error and the defaults of the zip limits on xlsx and ods import. |
formulaToLocale(formula, locale), formulaFromLocale(text, locale), inputFromLocale(text, locale), resolveFormatLocale(tag), DE_DE, FR_FR, ES_ES, EN_US |
Locale conversion for formulas and typed input, and the built-in locale objects. |
toOpenFormula(formula), fromOpenFormula(formula) from @birchui/spreadsheet/ods |
Convert a formula between Excel syntax and OpenFormula. |
listFunctions() |
Every built-in function as { name, category, args, summary, volatile }, sorted by name. The function reference is generated from it. |
formatValue(value, code), formatKind(code), isDateFormat(code) |
The number formatter. |
dateToSerial(date), serialToDate(serial) |
Convert between Date objects and date serials, in UTC. |
formulaToR1C1(formula, cell), formulaFromR1C1(formula, cell) |
Convert a formula between A1 and R1C1 notation, relative to the cell that holds it. |
toA1(row, column), fromA1(address), columnName(column) |
Convert between 0-based indexes and A1 addresses: toA1(0, 27) is AB1, fromA1('AB12') is { row: 11, col: 27 }. |
isCellError(value) |
Whether a cell value is an error, such as #N/A. |
ValidationError, ProtectionError |
The errors thrown by blocked API writes. ValidationError has sheet, address (the first rejected cell) and rejected (how many cells failed); ProtectionError has sheet for a protected sheet and no sheet for the workbook structure. |
spreadsheetStyles |
The component's CSS as a string. |
Types include WorkbookJSON, SheetJSON, CellJSON, CellStyle, CellValue, CellInput, ConditionalFormat and its rule types, DataValidation, TableJSON, CellNote, Hyperlink, SheetProtection, ImageJSON, ChartJSON with ChartSeries, ChartTrendline, ChartErrorBars, ChartDataLabels and ChartAxisOptions, SparklineGroup, PageSetup, FindOptions, WriteOptions, ValidationMode, SheetOperation, SheetOperationEvent, PresenceCursor, CollaborationProvider, CollaborationSession, CollaborationOptions, CollaborationAuthority, CommittedOperation, ClientMessage, ServerMessage, FormulaEngine, FunctionInfo, CustomFunctionSet, CustomFunctionDefinition, CustomFunctionOptions and CustomFunctionImpl. For files there are XlsxExportOptions, XlsxOpenOptions, XlsxImportOptions, XlsxImportProgress, XlsxImportPhase, XlsxImportReport, XlsxReportEntry, XlsxValidationIssue, CsvImportOptions, CsvExportOptions, CsvDialect, CsvParseResult, OdsImportOptions, OdsExportOptions, EncryptionError, EncryptionErrorCode and EncryptionSummary; for the model, PivotTableJSON, SlicerJSON, ShapeJSON, SheetView, DocumentProperties, SortState and ColumnFilter.