modern-xlsx API Reference - v1.3.0
    Preparing search index...

    Interface XlsxWorker

    Client for the XLSX worker: reads and writes workbooks on a worker thread.

    interface XlsxWorker {
        "[dispose]"(): void;
        readBuffer(
            data: Uint8Array,
            options?: { password?: string },
        ): Promise<WorkbookData>;
        terminate(): void;
        writeBuffer(
            data: WorkbookData,
            options?: { password?: string },
        ): Promise<Uint8Array<ArrayBufferLike>>;
    }
    Index
    • Read XLSX bytes into parsed WorkbookData (runs in worker thread).

      When data spans its whole ArrayBuffer, that buffer is transferred to the worker and detached (data becomes unusable). When data is a view on part of a buffer, or on a SharedArrayBuffer, it is copied instead and the caller's buffer is left intact.

      Parameters

      • data: Uint8Array
      • Optionaloptions: { password?: string }

      Returns Promise<WorkbookData>

    • Write WorkbookData to XLSX bytes (runs in worker thread).

      Parameters

      Returns Promise<Uint8Array<ArrayBufferLike>>

      ModernXlsxError with code INVALID_WORKBOOK for the causes listed with that code in errors.ts, and WORKER_ERROR when the worker crashed, was terminated or returned no data.