Skip to content


Repository files navigation


Excel2json is a Rust and WebAssembly-based library that allows easily converting files in Excel format to JSON files.

npm version

How to build


cargo install wasm-pack
wasm-pack build

How to use via npm

  • install the module
yarn add excel2json-wasm
  • import and use the module
// worker.js
import {convert} "excel2json-wasm";
// convert int-array, works in sync mode
const json = convertArray(Int8Array, optional_config);
// converts file object or int-array in async mode
convert(file_object_or_typed_array, optional_config).then(json => {
    // do something

How to use from CDN

CDN links are the following:

You can import and use lib dynamically like

const convert = import("");
const blob = convert(json_data_to_export);

or use it as web worker

var url = window.URL.createObjectURL(new Blob([
], { type: "text/javascript" }));

// you need to server worker from the same domain as the main script
var worker = new Worker("./worker.js"); 
worker.addEventListener("message", ev => {
    if ( === "ready"){
        const json =;
        // do something
    data: file_object
worker.addEventListener("message", e => {
    if ({
        // worker is ready

if you want to load worker script from CDN and not from your domain it requires a more complicated approach, as you need to catch the moment when service inside of the worker will be fully initialized

var url = window.URL.createObjectURL(new Blob([
], { type: "text/javascript" }));

var worker = new Promise((res) => {
    const x = Worker(url); 
    worker.addEventListener("message", ev => {
        if ( === "ready"){
            const json =;
            // do something with result
        } else if ( === "init"){
            // service is ready

worker.then(x => x.postMessage({
    data: file_object

Export formulas

const json = convert(data, { formulas:true });


    type: "convert",
    data: file_object_or_typed_array,
    formulas: true

Output format

interface IConvertMessageData {
    uid?: string;
    data: Uint8Array | File;
    sheet?: string;
    styles?: boolean;
    wasmPath?: string;

interface IReadyMessageData {
    uid: string;
    data: ISheetData[];
    styles: IStyles[];

interface ISheetData {
    name: string;
    cols: IColumnData[];
    rows: IRowData[];
    cells: IDataCell[][];   // null for empty cell

    merged: IMergedCell[];

interface IMergedCell {
    from: IDataPoint;
    to: IDataPoint;

interface IDataPoint {
    column: number; 
    row: number;

interface IColumnData {
    width: number;

interface IRowData {
    height: number;

interface IDataCell{
    v: string;
    s: number:

interface IStyle {
    fontSize?: string;
    fontFamily?: string;

    background?: string;
    color?: string;

    fontWeight?: string;
    fontStyle?: string;
    textDecoration?: string;

    align?: string;
    verticalAlign?: string;

    borderLeft?: string;
    borderTop?: string;
    borderBottom?: string;
    borderRight?: string;

    format?: string;