See Event direction for committed
transaction sources and framework readiness events.
Stable failure envelope
Every consumer-visible initialization, datasource, renderer, export, persistence,
snapshot, synchronization, collaboration, CSV, and XLSX failure is a
SheetwriteError. Use code and operation for control flow; message is
diagnostic text and may become more specific. context contains
serialization-safe boundary details, retryable is present only when
Sheetwrite can determine it, and cause retains the original exception in the
current realm. toJSON() omits cause.
declare const wasmUrl : URL ;
declare const correctedWasmUrl : URL ;
declare function showInitializationError ( message : string ) : void ;
// A failed source does not poison readiness. Retry with corrected input.
The guard also recognizes validated cross-realm and serialized envelopes. A
serialized envelope is structural; code that requires Error identity should
construct or receive a live SheetwriteError.
declare function retryVisibleRows ( request : {
readonly revision : number ;
declare function reportDegradedRendering ( code : string ) : void ;
declare function promptToEnableXlsx () : void ;
grid . on ( "renderer-fallback" , ({ error }) => { // Canvas rendering is already active; do not remount the Grid.
if ( error . code === "optional-backend-unavailable" ) {
Framework initialization callbacks and Grid operational events carry the same
class identity exported by @sheetwrite/core and @sheetwrite/core/adapter.
Normal mutation denials remain mutation-rejected results/events, and
incomplete paged queries retain their explicit capability/result contracts;
they are not converted into generic exceptions.
Typed error index
Start with SheetwriteError and
isSheetwriteError . Branch on the stable
code and operation fields; use the boundary-specific classes below only when
their structured fields are needed.
The complete enums are SheetwriteErrorCode
and SheetwriteErrorOperation ;
their runtime value sets are
SHEETWRITE_ERROR_CODES and
SHEETWRITE_ERROR_OPERATIONS .
Recovery by boundary
SnapshotValidationError rejects malformed workbooks before partial hydration. Inspect its path-qualified errors; fix or reject the source instead of retrying unchanged bytes.
SnapshotResourceError reports bounded workbook construction. Reduce the document or explicitly raise the named host-controlled ceiling.
DelimitedTextOptionsError rejects an invalid CSV/TSV ceiling before work starts. Correct the option; retrying the same configuration cannot succeed.
DelimitedTextResourceError and XlsxResourceError retain resource, limit, and actual. Reduce the input/output or explicitly change the applicable limit.
IncompleteDataError identifies datasource pages required by the operation. Load those pages or use a visible-window operation; do not treat unloaded cells as empty.
PersistenceError retains the host load/commit cause; its code distinguishes aborted work, invalid snapshots, resource limits, missing state, and rejected commits.
IndexedDbPendingCommitStorageError distinguishes unavailable, blocked, aborted, corrupt, and quota-limited browser storage.
SyncProtocolError rejects malformed or resource-violating remote input. Fix the producer; do not replay the same payload.
SyncPendingCapacityError rejects a new local transaction before it can exceed the durable queue ceiling. Drain or reconcile pending work before retrying.
Worker startup and capability failures switch to the canvas renderer and emit renderer-fallback; observe grid.rendererKind to report the active renderer, not the requested option.
function initSheetwrite(source?: BufferSource | URL | string | Request | WebAssembly.Module, engine?: SheetwriteEngine): Promise<void> function initSheetwrite (
source ?:
BufferSource | URL | string | Request | WebAssembly . Module ,
engine ?: SheetwriteEngine ,
) : Promise < void > function initSheetwrite (
source ?:
| BufferSource
| URL
| string
| Request
| WebAssembly . Module ,
engine ?: SheetwriteEngine ,
) : Promise < void > Load one WASM engine before createGrid. The default is @sheetwrite/wasm. Pass the @sheetwrite/formulas module as the second argument to select the full engine. Example import { initSheetwrite } from "@sheetwrite/core" ;
import * as formulas from "@sheetwrite/formulas" ;
await initSheetwrite ( undefined , formulas); See also /docs/start/choose-an-engine/ See also createGrid API reference → function isSheetwriteError(value: unknown): value is SheetwriteErrorEnvelope function isSheetwriteError (
value : unknown ,
) : value is SheetwriteErrorEnvelope function isSheetwriteError (
value : unknown ,
) : value is SheetwriteErrorEnvelope Narrow same-realm errors, cross-realm errors, and serialized failure envelopes. API reference → interface URL interface URL interface URL The URL interface is used to parse, construct, normalize, and encode URL. MDN Reference const wasmUrl: URL const wasmUrl : URL const wasmUrl : URL var error: unknown var error : unknown var error : unknown var error: SheetwriteErrorEnvelope var error : SheetwriteErrorEnvelope var error : SheetwriteErrorEnvelope API reference → SheetwriteErrorEnvelope.code: "conflict" | "incomplete-data" | "initialization-failed" | "initialization-required" | "datasource-request-failed" | "renderer-fallback" | "export-failed" | "xlsx-import-failed" | "optional-backend-unavailable" | "delimited-text-resource-limit" | "delimited-text-invalid-limit" | "xlsx-resource-limit" | "resource-limit" | "invalid-snapshot" | "aborted" | "not-found" | "commit-rejected" | "unavailable" | "blocked" | "quota" | "unsupported-schema" | "transaction" | "limit" | "invalid-limits" | "invalid-version" | "invalid-id" | ... 24 more ... | "shortcut-conflict" interface SheetwriteErrorEnvelope { code : "conflict" | "incomplete-data" | "initialization-failed" | "initialization-required" | "datasource-request-failed" | "renderer-fallback" | "export-failed" | "xlsx-import-failed" | "optional-backend-unavailable" | "delimited-text-resource-limit" | "delimited-text-invalid-limit" | "xlsx-resource-limit" | "resource-limit" | "invalid-snapshot" | "aborted" | "not-found" | "commit-rejected" | "unavailable" | "blocked" | "quota" | "unsupported-schema" | "transaction" | "limit" | "invalid-limits" | "invalid-version" | "invalid-id" | ... 24 more ... | "shortcut-conflict" } interface SheetwriteErrorEnvelope { code : "conflict" | "incomplete-data" | "initialization-failed" | "initialization-required" | "datasource-request-failed" | "renderer-fallback" | "export-failed" | "xlsx-import-failed" | "optional-backend-unavailable" | "delimited-text-resource-limit" | "delimited-text-invalid-limit" | "xlsx-resource-limit" | "resource-limit" | "invalid-snapshot" | "aborted" | "not-found" | "commit-rejected" | "unavailable" | "blocked" | "quota" | "unsupported-schema" | "transaction" | "limit" | "invalid-limits" | "invalid-version" | "invalid-id" | ... 24 more ... | "shortcut-conflict" } API reference → function showInitializationError(message: string): void function showInitializationError ( message : string ) : void function showInitializationError (
message : string ,
) : void SheetwriteErrorEnvelope.message: string interface SheetwriteErrorEnvelope {
message : string ;
} interface SheetwriteErrorEnvelope {
message : string ;
} API reference → const correctedWasmUrl: URL const correctedWasmUrl : URL const correctedWasmUrl : URL function retryVisibleRows(request: {
readonly sheet: string;
readonly start: number;
readonly end: number;
readonly revision: number;
}): void function retryVisibleRows ( request : {
readonly sheet : string ;
readonly start : number ;
readonly end : number ;
readonly revision : number ;
}) : void function retryVisibleRows ( request : {
readonly sheet : string ;
readonly start : number ;
readonly end : number ;
readonly revision : number ;
}) : void request: {
readonly sheet: string;
readonly start: number;
readonly end: number;
readonly revision: number;
} let request : {
readonly sheet : string ;
readonly start : number ;
readonly end : number ;
readonly revision : number ;
} let request : {
readonly sheet : string ;
readonly start : number ;
readonly end : number ;
readonly revision : number ;
} sheet: string let sheet : string let sheet : string Sheet identity used by the simple data-first adapter. Defaults to sheet1. API reference → start: number let start : number let start : number Zero-based workbook column index of the first key. API reference → end: number let end : number let end : number Exclusive workbook column index after the last key. API reference → const grid: Grid const grid : Grid const grid : Grid The imperative core grid this controller owns. API reference → Grid.on<"datasource-error">(evt: "datasource-error", fn: (e: {
request: Omit<DataSourceRequest, "signal">;
error: SheetwriteError;
}) => void): () => void Grid. on < "datasource-error" >(evt: "datasource-error" , fn: ( e : {
request : Omit < DataSourceRequest , "signal" >;
error : SheetwriteError ;
}) => void ): () => void Grid. on < "datasource-error" >(evt: "datasource-error" , fn: ( e : {
request : Omit < DataSourceRequest , "signal" >;
error : SheetwriteError ;
}) => void ): () => void request: Omit<DataSourceRequest, "signal"> let request : Omit < DataSourceRequest , "signal" > let request : Omit <
DataSourceRequest ,
"signal"
> API reference → error: SheetwriteError let error : SheetwriteError let error : SheetwriteError API reference → SheetwriteError.retryable?: boolean | undefined interface SheetwriteError {
retryable ?: boolean | undefined ;
} interface SheetwriteError {
retryable ?: boolean | undefined ;
} Present only when Sheetwrite can determine retryability from the boundary itself. API reference → Grid.on<"renderer-fallback">(evt: "renderer-fallback", fn: (e: {
requested: "worker";
error: SheetwriteError;
}) => void): () => void Grid. on < "renderer-fallback" >(evt: "renderer-fallback" , fn: ( e : {
requested : "worker" ;
error : SheetwriteError ;
}) => void ): () => void Grid. on < "renderer-fallback" >(evt: "renderer-fallback" , fn: ( e : {
requested : "worker" ;
error : SheetwriteError ;
}) => void ): () => void function reportDegradedRendering(code: string): void function reportDegradedRendering ( code : string ) : void function reportDegradedRendering (
code : string ,
) : void SheetwriteError.code: "conflict" | "incomplete-data" | "renderer-fallback" | "initialization-failed" | "initialization-required" | "datasource-request-failed" | "export-failed" | "xlsx-import-failed" | "optional-backend-unavailable" | "delimited-text-resource-limit" | "delimited-text-invalid-limit" | "xlsx-resource-limit" | "resource-limit" | "invalid-snapshot" | "aborted" | "not-found" | "commit-rejected" | "unavailable" | "blocked" | "quota" | "unsupported-schema" | "transaction" | "limit" | "invalid-limits" | "invalid-version" | "invalid-id" | ... 24 more ... | "shortcut-conflict" interface SheetwriteError { code : "conflict" | "incomplete-data" | "renderer-fallback" | "initialization-failed" | "initialization-required" | "datasource-request-failed" | "export-failed" | "xlsx-import-failed" | "optional-backend-unavailable" | "delimited-text-resource-limit" | "delimited-text-invalid-limit" | "xlsx-resource-limit" | "resource-limit" | "invalid-snapshot" | "aborted" | "not-found" | "commit-rejected" | "unavailable" | "blocked" | "quota" | "unsupported-schema" | "transaction" | "limit" | "invalid-limits" | "invalid-version" | "invalid-id" | ... 24 more ... | "shortcut-conflict" } interface SheetwriteError { code : "conflict" | "incomplete-data" | "renderer-fallback" | "initialization-failed" | "initialization-required" | "datasource-request-failed" | "export-failed" | "xlsx-import-failed" | "optional-backend-unavailable" | "delimited-text-resource-limit" | "delimited-text-invalid-limit" | "xlsx-resource-limit" | "resource-limit" | "invalid-snapshot" | "aborted" | "not-found" | "commit-rejected" | "unavailable" | "blocked" | "quota" | "unsupported-schema" | "transaction" | "limit" | "invalid-limits" | "invalid-version" | "invalid-id" | ... 24 more ... | "shortcut-conflict" } API reference → Grid.on<"export-error">(evt: "export-error", fn: (e: {
format: "csv" | "xlsx";
error: SheetwriteError;
}) => void): () => void Grid. on < "export-error" >(evt: "export-error" , fn: ( e : {
format : "csv" | "xlsx" ;
error : SheetwriteError ;
}) => void ): () => void Grid. on < "export-error" >(evt: "export-error" , fn: ( e : {
format : "csv" | "xlsx" ;
error : SheetwriteError ;
}) => void ): () => void function promptToEnableXlsx(): void function promptToEnableXlsx () : void function promptToEnableXlsx () : void